intenziti Posted August 23, 2007 Share Posted August 23, 2007 I'm wondering if someone would be so kind as to please help me with a problem I am having with a form which upon submitting is to have its data inserted into a MYSQL database. That database and table are set up. The table is called 'reservations' and it has 5 fields to hold the input data. However I keep getting this error: Parse error: syntax error, unexpected $end in /Applications/xampp/xamppfiles/htdocs/paul/reservation_send.php on line 38 The funny thing is though that there is no lone 38, the script finishes on line 34. Any ideas on this one? Is the coding I have used the best way to write data to a mysql database or does someone have some better code. I am finding this quite frustrating as you would think it would be an easy enough script to do but I don't seem to be having much luck with it. Any help would greatly be appreciated! Please see below for the code I am using THANK YOU! The form code <table width="600" align="center" cellspacing="15"><tr> <td width="300"> <h3>Please fill out the details below to reserve your place:</h3> <br/><form method="post" action="reservation_send.php" ><!--command telling form data to be redirected to php script for processing--> <table width="100%" border="0" cellspacing="1" cellpadding="2"> <tr> <td valign="top" >*</td> <td colspan="2"><p><strong>Indicates a required field</strong></p> </td> </tr> <tr> <td colspan="3" valign="top"> </td> </tr> <tr> <td valign="top" >*</td> <td class="label">First name:</td> <td><INPUT TYPE='first name' NAME='first name' SIZE='20'></td><!--Freeform text imput (small area)--> </tr> <tr> <td valign="top" >*</td> <td class="label">Last name:</td> <td><INPUT TYPE='last name' NAME='last name' SIZE='20'> </td><!--Freeform text imput (small area)--> </tr> <tr> <td valign="top" >*</td> <td class="label">Contact email:</td> <td><INPUT TYPE='email' NAME='email' SIZE='20'></td> </tr> <tr> <td valign="top" ></td> <td class="label">Contact number(please include country & area codes):</td> <td><INPUT TYPE='number' NAME='number' SIZE='20'></td> </tr> <tr> <td valign="top" >*</td> <td class="label">Country:</td> <td><INPUT TYPE='country' NAME='country' SIZE='20'></td> </tr> <tr> <td colspan="3" valign="top"> </td> </tr> <tr> <td> </td> <td> </td> <td><INPUT TYPE="RESET" VALUE="Reset" NAME="reset"> <INPUT TYPE="SUBMIT" VALUE="Submit" NAME="submit"> </td><!--Submit button which user clicks on to send data to php to be processed--> </tr> </table> <br> </form></td></tr></table> The PHP script <?php $dbuser = "sworphe_paul"; $dbserver = "localhost"; $dbpass = "sworphe_paul"; $dbname = "sworphe_paul"; //CONNECTION STRING mysql_connect($dbserver, $dbuser, $dbpass) or die ("Unable to connect to database"); mysql_select_db($dbname) or die ("Unable to select database"); if ($post == "yes") { $sql = "INSERT INTO reservations ( first name, last name, email, number, country $addl_insert_crit ) VALUES ( '$first name', '$last name', '$email', '$number', '$country' $addl_insert_values )"; if ($sql_debug_mode==1) { echo "<BR>SQL: $sql<BR>"; } $result = mysql_query($sql,db()); if ($result == 1) { echo "Record Inserted"; } else { echo "Error inserting record (9994SQL)"; } ?> Quote Link to comment Share on other sites More sharing options...
thryb Posted August 23, 2007 Share Posted August 23, 2007 You are missing a } echo "Error inserting record (9994SQL)"; } } ?> Quote Link to comment Share on other sites More sharing options...
intenziti Posted August 23, 2007 Author Share Posted August 23, 2007 Thanks for that. I added the extra bit on the end however now it just goes through to a blank white page with no message. I checked the table on the server and it has no new data ??? Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.