I created a registration page with php, when the submit button is pushed the information is supposed to be posted to my MySQL database. But what happens instead is this message appears if I fill in all the textfields and click the checkboxes:
You have an error in your SQL syntax near 'yrs','12','yes','45333','54','detas')' at line 3
Those values: yrs, 12, yes, 45333, 54, detas are what I entered into the textfields on the registration.php page.
If I don't enter anything in the fields or checkboxes and click the submit button I get this error message:
You have an error in your SQL syntax near '','','','','','','','','','','','','','','','',''
,'','','','','','','', '','',''' at line 3
I don't understand what line 3 means since the third line in the php page is actually html. It is not until the 63rd line that I use the Insert statement and perform basic SQL This is the code that does this:
if($SERVER['REQUEST_METHOD']=="POST" && isset($POST['submit'])) {
$sql = "INSERT INTO reg_table (onypl, address3, ogypq, city, state5, onyee, ocypa, email, sex, orcaj, mstatus, ozypz, paymenttype, oyypz, employer, occupation, address4, empcity, state3, insured, inscity, state2, ogypk, insco2, insco, okypa, oyypk, owypa, inscocity, inscoaddress, state7, ooypk, ozypk, owypb, address1, city1, state1, ocypd, textarea4, textarea6, textarea7, textarea3, textarea5, textarea1, 25hizt298, 54hizt298, 41hizt298, 00hizt298, 31hizt298, 42hizt298, 98hizt298, 02hizt298, 32hizt298, 01hizt298, 04hizt298, 05hizt298, 08hizt298, 06hizt298, 03hizt298, 07hizt298, 10hizt298, 11hizt298, 43hizt298, 87hizt298, 76hizt298, 56hizt298, 94hizt298, 44hizt298, 81hizt298, 55hizt298, 53hizt298, 57hizt298, 77hizt298, 89hizt298, 99hizt298, 88hizt298, 47hizt298, 40hizt298, 14hizt298, 66hizt298, 58hizt298, 67hizt298, 74hizt298, 70hizt298, 60hizt298, 62hizt298, 38hizt298, 37hizt298, 17hizt298, 15hizt298, 46hizt298, 64hizt298, 48hizt298, 85hizt298, 90hizt298, 34hizt298, 51hizt298, 52hizt298, 84hizt298,
83hizt298, 71hizt298, 72hizt298, 79hizt298, 29hizt298, 86hizt298, 69hizt298, 35hizt298, 75hizt298, 59hizt298, 61hizt298, 65hizt298, 73hizt298, 68hizt298, 63hizt298, 50hizt298, 49hizt298, 45hizt298, 39hizt298, 82hizt298, ozypk2, ozypk4, ozypk22, ozypk3, ozypk42, ozypk23) VALUES
('$name','$address3','$aptno','$city','$state5','$
onypz','$odypr','$email','$select2','$orypq','$mst
atus','$textfield9','$paymenttype','$textfield10',
'$employer','$occupation','$address4','$empcity','
$state3','$textfield86','$inscity','$state2','$ogy
pk','$insco2','$insco','$okypa','$oyypk','$owypa',
'$inscocity','$inscoaddress','$state7','$ooypk','$
ozypk','$owypb','$address1','$city1','$state1','$o
cypd','$texarea4','$texarea6','$texarea7','$texare
a3','$texarea5','$texarea1','$anpat','$anpar','$an
sib','$arpat','$arpar','$arsib','$aspat','$aspar',
'$assib','$blapat','$blapar','$blasib','$blepat','
$blepar','$blesib','$bopat','$bopar','$bosib','$di
pat','$dipar','$disib','$ecpat','$ecpar','$ecsib',
'$hapat','$hapar','$hasib','$heapat','$heapar','$h
easib','$heppat','$heppar','$hepsib','$hipat,'$hip
ar','$hisib','$hivpat','$hivpar','$hivsib','$inpat
','$inpar','$insib','$lipat','$lipar','$lisib','$m
epat','$mepar','$mesib','$otpat','$otpar','$otsib'
,'$popat','$popar','$posib','$pspat','$pspar','$ps
sib',
'$scpat','$scpar','$sipat','$sipar','$sisib','$scs
ib','$skpat','$skpar','$sksib','$tupat','$tupar','
$tusib','$thpat','$thpar','$thsib','$ulpat','$ulpa
r','$ulsib','$ozypk2','$ozypk4','$ozypk22','$ozypk
3','$ozypk42','$ozypk23')";
$result =@($sql) or die(mysql_error());
echo "<b>$name</b> has been submitted. Thank you.\n";
echo "<a href=\"prafrt.htm\">return to Registration section</a>";
} else {
?><form name="form1" method="post" action="registration.php"><table width="100%" border="0" cellspacing="0" cellpadding="0">
Any suggestions
Thank you
Sincerely,
Goonboonie