PHP Code:
<?php
$cid = mysql_connect('localhost', 'root', '');
mysql_select_db('domains', $cid);
$fields = array('fname', 'lname', 'email', 'domain', 'length', 'address');
$fieldlist = '';
foreach ($fields as $field) {
if (!empty($fieldlist)) {
$fieldlist .= ', ';
}
$fieldlist .= "$field = '".addslashes($_POST["$field"])."'";
}
mysql_query("
INSERT INTO domains
SET $fieldlist
");
mysql_close($cid);
?>