skot Posted August 17, 2009 Share Posted August 17, 2009 Hi All, I'm trying to set up a survey that will post form results to a database. Now bare with me because this is the first time I've really used mysql with php. Basically I get this error and I'm not sure why. Parse error: syntax error, unexpected T_LNUMBER, expecting T_VARIABLE or '$' in /home/bridgey/public_html/SendFeedback.php on line 11 Heres the code for the form page: <form name="contactform" id="contactform" method="post" action="SendFeedback.php" onsubmit="return validate_form(this);"> <div align="center"> <p><br /> <strong>We would be greatful if you could spare a moment of your time to let us know what you thought about your support experience today.<br /> <br /> This process is completely optional and you can close this page if you wish. All feedback received will be treated confidentially.</strong></p> <table border="0" cellpadding="0" cellspacing="0"> <tr> <td height="26" class="style51"><div align="right" class="style51"> <div align="right" class="style6"> <div align="right" class="style51"><strong>Your Name: </strong></div> </div> </div></td> <td colspan="5" align="left" class="style51"><span class="style6 style5"> <input name="name" type="text" class="textfield" id="name" style="border: 1px groove #036B6A; font-family:tahoma; font-size:14px; background:transparent url('http://www.centurysoftware.co.uk/img/field_bg4.gif')" size="30" maxlength="40"/> </span></td> </tr> <tr> <td height="26" class="style51"><div align="right" class="style51"> <div align="right"><strong>Company Name: </strong></div> </div></td> <td colspan="5" align="left" class="style51"><span class="style6 style5"> <input name="company" type="text" class="textfield" id="company" style="border: 1px groove #036B6A; font-family:tahoma; font-size:14px; background:transparent url('http://www.centurysoftware.co.uk/img/field_bg4.gif')" size="30" maxlength="40"/> </span></td> </tr> <tr> <td height="26" class="style51"><div align="center" class="style51"> <div align="right"><strong>Email Address: <br /> </strong></div> </div></td> <td colspan="5" align="left" class="style51"><span class="style6 style5"> <input name="email" type="text" class="textfield" id="email" style="border: 1px groove #036B6A; font-family:tahoma; font-size:14px; background:transparent url('http://www.centurysoftware.co.uk/img/field_bg4.gif')" size="30" maxlength="40"/> </span></td> </tr> </table> <br /> <table border="0" cellspacing="0" cellpadding="0"> <tr> <td height="26" colspan="6" class="style5"><div align="center" class="style51"> <div align="center"><strong>Please rate us on the following aspects of your support experience</strong><br /> <em>Please tick only one box per question</em><br /> <br /> </div> </div></td> </tr> <tr> <td height="26" align="left" valign="middle" class="style5"><div align="left" class="style51"> <div align="left"><strong><br /> </strong></div> </div></td> <td width="55" height="26" align="center" valign="middle" class="style5" style="font-size: 9px; font-style: italic; font-weight: bold;">VeryPoor</td> <td width="55" align="center" valign="middle" class="style5"><span class="style51" style="font-size: 9px; font-style: italic; font-weight: bold;">Poor</span></td> <td width="55" align="center" valign="middle" class="style5"><span class="style51" style="font-size: 9px; font-style: italic; font-weight: bold;">Fair</span></td> <td width="55" align="center" valign="middle" class="style5"><span class="style51" style="font-size: 9px; font-style: italic; font-weight: bold;">Good</span></td> <td width="55" align="center" valign="middle" class="style5"><span class="style51" style="font-size: 9px; font-style: italic; font-weight: bold;">Very Good</span></td> </tr> <tr> <td height="26" class="style5"><strong> 1. The speed at which your query was dealt with </strong></td> <td width="55" height="26" align="center" valign="middle" class="style5"><input value="1" type="checkbox" name="1a" id="1a" /></td> <td width="55" align="center" valign="middle" class="style5"><span class="style51"> <input value="1" type="checkbox" name="1b" id="1b" /> </span></td> <td width="55" align="center" valign="middle" class="style5"><span class="style51"> <input value="1" type="checkbox" name="1c" id="1c" /> </span></td> <td width="55" align="center" valign="middle" class="style5"><span class="style51"> <input value="1" type="checkbox" name="1d" id="1d" /> </span></td> <td width="55" align="center" valign="middle" class="style5"><span class="style51"> <input value="1" type="checkbox" name="1e" id="1e" /> </span></td> </tr> <tr> <td height="26" class="style5"><strong> 2. The quality of the solution provided</strong></td> <td width="55" height="26" align="center" valign="middle" class="style5"><input type="checkbox" name="2a" id="2a" /></td> <td width="55" align="center" valign="middle" class="style5"><span class="style51"> <input value="1" type="checkbox" name="2b" id="2b" /> </span></td> <td width="55" align="center" valign="middle" class="style5"><span class="style51"> <input value="1" type="checkbox" name="2c" id="2c" /> </span></td> <td width="55" align="center" valign="middle" class="style5"><span class="style51"> <input value="1" type="checkbox" name="2d" id="2d" /> </span></td> <td width="55" align="center" valign="middle" class="style5"><span class="style51"> <input value="1" type="checkbox" name="2e" id="2e" /> </span></td> </tr> <tr> <td height="26" class="style5"><strong>3. Technical knowledge of the person who worked with you</strong></td> <td width="55" height="26" align="center" valign="middle" class="style5"><input type="checkbox" name="3a" id="3a" /></td> <td width="55" align="center" valign="middle" class="style5"><span class="style51"> <input value="1" type="checkbox" name="3b" id="3b" /> </span></td> <td width="55" align="center" valign="middle" class="style5"><span class="style51"> <input value="1" type="checkbox" name="3c" id="3c" /> </span></td> <td width="55" align="center" valign="middle" class="style5"><span class="style51"> <input value="1" type="checkbox" name="3d" id="3d" /> </span></td> <td width="55" align="center" valign="middle" class="style5"><span class="style51"> <input value="1" type="checkbox" name="3e" id="3e" /> </span></td> </tr> <tr> <td height="26" class="style5"><strong>4. Our ability to understand your needs</strong></td> <td width="55" height="26" align="center" valign="middle" class="style5"><input type="checkbox" name="4a" id="4a" /></td> <td width="55" align="center" valign="middle" class="style5"><span class="style51"> <input value="1" type="checkbox" name="4b" id="4b" /> </span></td> <td width="55" align="center" valign="middle" class="style5"><span class="style51"> <input value="1" type="checkbox" name="4c" id="4c" /> </span></td> <td width="55" align="center" valign="middle" class="style5"><span class="style51"> <input value="1" type="checkbox" name="4d" id="4d" /> </span></td> <td width="55" align="center" valign="middle" class="style5"><span class="style51"> <input value="1" type="checkbox" name="4e" id="4e" /> </span></td> </tr> <tr> <td height="26" class="style5"><strong>5. Keeping you informed on the status of your enquiry</strong></td> <td width="55" height="26" align="center" valign="middle" class="style5"><input type="checkbox" name="5a" id="5a" /></td> <td width="55" align="center" valign="middle" class="style5"><span class="style51"> <input value="1" type="checkbox" name="5b" id="5b" /> </span></td> <td width="55" align="center" valign="middle" class="style5"><span class="style51"> <input value="1" type="checkbox" name="5c" id="5c" /> </span></td> <td width="55" align="center" valign="middle" class="style5"><span class="style51"> <input value="1" type="checkbox" name="5d" id="5d" /> </span></td> <td width="55" align="center" valign="middle" class="style5"><span class="style51"> <input value="1" type="checkbox" name="5e" id="5e" /> </span></td> </tr> <tr> <td height="26" class="style5"><strong>6. How friendly and professional we were</strong></td> <td width="55" height="26" align="center" valign="middle" class="style5"><input type="checkbox" name="6a" id="6a" /></td> <td width="55" align="center" valign="middle" class="style5"><span class="style51"> <input value="1" type="checkbox" name="6b" id="6b" /> </span></td> <td width="55" align="center" valign="middle" class="style5"><span class="style51"> <input value="1" type="checkbox" name="6c" id="6c" /> </span></td> <td width="55" align="center" valign="middle" class="style5"><span class="style51"> <input value="1" type="checkbox" name="6d" id="6d" /> </span></td> <td width="55" align="center" valign="middle" class="style5"><span class="style51"> <input value="1" type="checkbox" name="6e" id="6e" /> </span></td> </tr> <tr> <td height="26" class="style5"><strong>7. How easy it was for you to contact us</strong></td> <td width="55" height="26" align="center" valign="middle" class="style5"><input type="checkbox" name="7a" id="7a" /></td> <td width="55" align="center" valign="middle" class="style5"><span class="style51"> <input value="1" type="checkbox" name="7b" id="7b" /> </span></td> <td width="55" align="center" valign="middle" class="style5"><span class="style51"> <input value="1" type="checkbox" name="7c" id="7c" /> </span></td> <td width="55" align="center" valign="middle" class="style5"><span class="style51"> <input value="1" type="checkbox" name="7d" id="7d" /> </span></td> <td width="55" align="center" valign="middle" class="style5"><span class="style51"> <input value="1" type="checkbox" name="7e" id="7e" /> </span></td> </tr> <tr> <td height="26" class="style5"><strong>8. Overall quality of service received</strong></td> <td width="55" height="26" align="center" valign="middle" class="style5"><input type="checkbox" name="8a" id="8a" /></td> <td width="55" align="center" valign="middle" class="style5"><span class="style51"> <input value="1" type="checkbox" name="8b" id="8b" /> </span></td> <td width="55" align="center" valign="middle" class="style5"><span class="style51"> <input value="1" type="checkbox" name="8c" id="8c" /> </span></td> <td width="55" align="center" valign="middle" class="style5"><span class="style51"> <input value="1" type="checkbox" name="8d" id="8d" /> </span></td> <td width="55" align="center" valign="middle" class="style5"><span class="style51"> <input value="1" type="checkbox" name="8e" id="8e" /> </span></td> </tr> </table> <br /> <table border="0" cellpadding="0" cellspacing="0"> <tr> <td height="26" class="style51"><strong>9. Would you like to comment on anything else?</strong></td> </tr> <tr> <td height="26" align="center" class="style51"><textarea name="9" id="9" cols="40" rows="3" style="border: 1px groove #036B6A; font-family:tahoma; font-size:14px; background:transparent url('http://www.centurysoftware.co.uk/img/field_bg4.gif')"></textarea></td> </tr> </table> <br /> </div><p align="center"> <input name="submit" type="submit" class="style6" id="submit" value="Send Feedback" style="border: 1px groove rgb(0, 0, 0); background:transparent url('http://www.centurysoftware.co.uk/img/button_bg1.jpg'); text-align: center; font-family: tahoma; font-size: 14px; color: rgb(255, 255, 255); font-weight:bold; width:200px" onclick="submitPressed()"></form> And here's my SendFeedback.php <?php @extract($_POST); $name = stripslashes($name); $company = stripslashes($company); $email = stripslashes($email); $1a = stripslashes($1a); $1b = stripslashes($1b); $1c = stripslashes($1c); $1d = stripslashes($1d); $1e = stripslashes($1e); $2a = stripslashes($2a); $2b = stripslashes($2b); $2c = stripslashes($2c); $2d = stripslashes($2d); $2e = stripslashes($2e); $3a = stripslashes($3a); $3b = stripslashes($3b); $3c = stripslashes($3c); $3d = stripslashes($3d); $3e = stripslashes($3e); $4a = stripslashes($4a); $4b = stripslashes($4b); $4c = stripslashes($4c); $4d = stripslashes($4d); $4e = stripslashes($4e); $5a = stripslashes($5a); $5b = stripslashes($5b); $5c = stripslashes($5c); $5d = stripslashes($5d); $5e = stripslashes($5e); $6a = stripslashes($6a); $6b = stripslashes($6b); $6c = stripslashes($6c); $6d = stripslashes($6d); $6e = stripslashes($6e); $7a = stripslashes($7a); $7b = stripslashes($7b); $7c = stripslashes($7c); $7d = stripslashes($7d); $7e = stripslashes($7e); $8a = stripslashes($8a); $8b = stripslashes($8b); $8c = stripslashes($8c); $8d = stripslashes($8d); $8e = stripslashes($8e); $9 = stripslashes($9); $dbhost = 'localhost'; $dbuser = '***********'; $dbpass = '***********'; $dbname = 'centuryfeedback'; $table = 'supportfeedback'; $conn = mysql_connect($dbhost, $dbuser, $dbpass) or die ('Error connecting to database'); mysql_select_db($dbname); @mysql_select_db("$dbname") or die("Error: Unable to select database"); $sqlquery = "INSERT INTO $table VALUES('','','$name','$company','$email','$1a','$1b','$1c','$1d','$1e','$2a','$2b','$2c','$2d','$2e','$3a','$3b','$3c','$3d','$3e','$4a','$4b','$4c','$4d','$4e','$5a','$5b','$5c','$5d','$5e','$6a','$6b','$6c','$6d','$6e','$7a','$7b','$7c','$7d','$7e','$8a','$8b','$8c','$8d','$8e','$9')"; mysql_close($conn); // redir when sent.... header("Location: http://centurysoftware.co.uk/fbsent.htm"); exit; ?> You can see it here: www.centurysoftware.co.uk/support/survey.htm Don't worry about the htm it is running php inside. Thanks in advance. Quote Link to comment https://forums.phpfreaks.com/topic/170731-solved-why-doesnt-my-survey-record-details-correctly-to-a-mysql-database/ Share on other sites More sharing options...
PFMaBiSmAd Posted August 18, 2009 Share Posted August 18, 2009 Variables cannot have a numeric digit as the first character of the variable name. Quote Link to comment https://forums.phpfreaks.com/topic/170731-solved-why-doesnt-my-survey-record-details-correctly-to-a-mysql-database/#findComment-900543 Share on other sites More sharing options...
skot Posted August 18, 2009 Author Share Posted August 18, 2009 Hi PFMaBiSmAd, thanks for the advice. I have redesigned everything including my database structure forms and php processing code to use "a1, b1.." instead of "1a, 1b..". I do not get any errors now, but if I look at the MySQL table through my control panel there are no entries within it. Quote Link to comment https://forums.phpfreaks.com/topic/170731-solved-why-doesnt-my-survey-record-details-correctly-to-a-mysql-database/#findComment-900781 Share on other sites More sharing options...
trq Posted August 18, 2009 Share Posted August 18, 2009 Post your current code. Quote Link to comment https://forums.phpfreaks.com/topic/170731-solved-why-doesnt-my-survey-record-details-correctly-to-a-mysql-database/#findComment-900784 Share on other sites More sharing options...
skot Posted August 18, 2009 Author Share Posted August 18, 2009 Form: <form name="contactform" id="contactform" method="post" action="SendFeedback.php"> <div align="center"> <p><br /> <strong>We would be greatful if you could spare a moment of your time to let us know what you thought about your support experience today.<br /> <br /> This process is completely optional and you can close this page if you wish. All feedback received will be treated confidentially.</strong></p> <table border="0" cellpadding="0" cellspacing="0"> <tr> <td height="26" class="style51"><div align="right" class="style51"> <div align="right" class="style6"> <div align="right" class="style51"><strong>Your Name: </strong></div> </div> </div></td> <td colspan="5" align="left" class="style51"><span class="style6 style5"> <input name="name" type="text" class="textfield" id="name" style="border: 1px groove #036B6A; font-family:tahoma; font-size:14px; background:transparent url('http://www.centurysoftware.co.uk/img/field_bg4.gif')" size="30" maxlength="40"/> </span></td> </tr> <tr> <td height="26" class="style51"><div align="right" class="style51"> <div align="right"><strong>Company Name: </strong></div> </div></td> <td colspan="5" align="left" class="style51"><span class="style6 style5"> <input name="company" type="text" class="textfield" id="company" style="border: 1px groove #036B6A; font-family:tahoma; font-size:14px; background:transparent url('http://www.centurysoftware.co.uk/img/field_bg4.gif')" size="30" maxlength="40"/> </span></td> </tr> <tr> <td height="26" class="style51"><div align="center" class="style51"> <div align="right"><strong>Email Address: <br /> </strong></div> </div></td> <td colspan="5" align="left" class="style51"><span class="style6 style5"> <input name="email" type="text" class="textfield" id="email" style="border: 1px groove #036B6A; font-family:tahoma; font-size:14px; background:transparent url('http://www.centurysoftware.co.uk/img/field_bg4.gif')" size="30" maxlength="40"/> </span></td> </tr> </table> <br /> <table border="0" cellspacing="0" cellpadding="0"> <tr> <td height="26" colspan="6" class="style5"><div align="center" class="style51"> <div align="center"><strong>Please rate us on the following aspects of your support experience</strong><br /> <em>Please tick only one box per question</em><br /> <br /> </div> </div></td> </tr> <tr> <td height="26" align="left" valign="middle" class="style5"><div align="left" class="style51"> <div align="left"><strong><br /> </strong></div> </div></td> <td width="55" height="26" align="center" valign="middle" class="style5" style="font-size: 9px; font-style: italic; font-weight: bold;">VeryPoor</td> <td width="55" align="center" valign="middle" class="style5"><span class="style51" style="font-size: 9px; font-style: italic; font-weight: bold;">Poor</span></td> <td width="55" align="center" valign="middle" class="style5"><span class="style51" style="font-size: 9px; font-style: italic; font-weight: bold;">Fair</span></td> <td width="55" align="center" valign="middle" class="style5"><span class="style51" style="font-size: 9px; font-style: italic; font-weight: bold;">Good</span></td> <td width="55" align="center" valign="middle" class="style5"><span class="style51" style="font-size: 9px; font-style: italic; font-weight: bold;">Very Good</span></td> </tr> <tr> <td height="26" class="style5"><strong> 1. The speed at which your query was dealt with </strong></td> <td width="55" height="26" align="center" valign="middle" class="style5"><input value="1" type="checkbox" name="a1" id="a1" /></td> <td width="55" align="center" valign="middle" class="style5"><span class="style51"> <input value="1" type="checkbox" name="b1" id="b1" /> </span></td> <td width="55" align="center" valign="middle" class="style5"><span class="style51"> <input value="1" type="checkbox" name="c1" id="c1" /> </span></td> <td width="55" align="center" valign="middle" class="style5"><span class="style51"> <input value="1" type="checkbox" name="d1" id="d1" /> </span></td> <td width="55" align="center" valign="middle" class="style5"><span class="style51"> <input value="1" type="checkbox" name="e1" id="e1" /> </span></td> </tr> <tr> <td height="26" class="style5"><strong> 2. The quality of the solution provided</strong></td> <td width="55" height="26" align="center" valign="middle" class="style5"><input type="checkbox" name="a2" id="a2" /></td> <td width="55" align="center" valign="middle" class="style5"><span class="style51"> <input value="1" type="checkbox" name="b2" id="b2" /> </span></td> <td width="55" align="center" valign="middle" class="style5"><span class="style51"> <input value="1" type="checkbox" name="c2" id="c2" /> </span></td> <td width="55" align="center" valign="middle" class="style5"><span class="style51"> <input value="1" type="checkbox" name="d2" id="d2" /> </span></td> <td width="55" align="center" valign="middle" class="style5"><span class="style51"> <input value="1" type="checkbox" name="e2" id="e2" /> </span></td> </tr> <tr> <td height="26" class="style5"><strong>3. Technical knowledge of the person who worked with you</strong></td> <td width="55" height="26" align="center" valign="middle" class="style5"><input type="checkbox" name="a3" id="a3" /></td> <td width="55" align="center" valign="middle" class="style5"><span class="style51"> <input value="1" type="checkbox" name="b3" id="b3" /> </span></td> <td width="55" align="center" valign="middle" class="style5"><span class="style51"> <input value="1" type="checkbox" name="c3" id="c3" /> </span></td> <td width="55" align="center" valign="middle" class="style5"><span class="style51"> <input value="1" type="checkbox" name="d3" id="d3" /> </span></td> <td width="55" align="center" valign="middle" class="style5"><span class="style51"> <input value="1" type="checkbox" name="e3" id="e3" /> </span></td> </tr> <tr> <td height="26" class="style5"><strong>4. Our ability to understand your needs</strong></td> <td width="55" height="26" align="center" valign="middle" class="style5"><input type="checkbox" name="a4" id="a4" /></td> <td width="55" align="center" valign="middle" class="style5"><span class="style51"> <input value="1" type="checkbox" name="b4" id="b4" /> </span></td> <td width="55" align="center" valign="middle" class="style5"><span class="style51"> <input value="1" type="checkbox" name="c4" id="c4" /> </span></td> <td width="55" align="center" valign="middle" class="style5"><span class="style51"> <input value="1" type="checkbox" name="d4" id="d4" /> </span></td> <td width="55" align="center" valign="middle" class="style5"><span class="style51"> <input value="1" type="checkbox" name="e4" id="e4" /> </span></td> </tr> <tr> <td height="26" class="style5"><strong>5. Keeping you informed on the status of your enquiry</strong></td> <td width="55" height="26" align="center" valign="middle" class="style5"><input type="checkbox" name="a5" id="a5" /></td> <td width="55" align="center" valign="middle" class="style5"><span class="style51"> <input value="1" type="checkbox" name="b5" id="b5" /> </span></td> <td width="55" align="center" valign="middle" class="style5"><span class="style51"> <input value="1" type="checkbox" name="c5" id="c5" /> </span></td> <td width="55" align="center" valign="middle" class="style5"><span class="style51"> <input value="1" type="checkbox" name="d5" id="d5" /> </span></td> <td width="55" align="center" valign="middle" class="style5"><span class="style51"> <input value="1" type="checkbox" name="e5" id="e5" /> </span></td> </tr> <tr> <td height="26" class="style5"><strong>6. How friendly and professional we were</strong></td> <td width="55" height="26" align="center" valign="middle" class="style5"><input type="checkbox" name="a6" id="a6" /></td> <td width="55" align="center" valign="middle" class="style5"><span class="style51"> <input value="1" type="checkbox" name="b6" id="b6" /> </span></td> <td width="55" align="center" valign="middle" class="style5"><span class="style51"> <input value="1" type="checkbox" name="c6" id="c6" /> </span></td> <td width="55" align="center" valign="middle" class="style5"><span class="style51"> <input value="1" type="checkbox" name="d6" id="d6" /> </span></td> <td width="55" align="center" valign="middle" class="style5"><span class="style51"> <input value="1" type="checkbox" name="e6" id="e6" /> </span></td> </tr> <tr> <td height="26" class="style5"><strong>7. How easy it was for you to contact us</strong></td> <td width="55" height="26" align="center" valign="middle" class="style5"><input type="checkbox" name="a7" id="a7" /></td> <td width="55" align="center" valign="middle" class="style5"><span class="style51"> <input value="1" type="checkbox" name="b7" id="b7" /> </span></td> <td width="55" align="center" valign="middle" class="style5"><span class="style51"> <input value="1" type="checkbox" name="c7" id="c7" /> </span></td> <td width="55" align="center" valign="middle" class="style5"><span class="style51"> <input value="1" type="checkbox" name="d7" id="d7" /> </span></td> <td width="55" align="center" valign="middle" class="style5"><span class="style51"> <input value="1" type="checkbox" name="e7" id="e7" /> </span></td> </tr> <tr> <td height="26" class="style5"><strong>8. Overall quality of service received</strong></td> <td width="55" height="26" align="center" valign="middle" class="style5"><input type="checkbox" name="a8" id="a8" /></td> <td width="55" align="center" valign="middle" class="style5"><span class="style51"> <input value="1" type="checkbox" name="b8" id="b8" /> </span></td> <td width="55" align="center" valign="middle" class="style5"><span class="style51"> <input value="1" type="checkbox" name="c8" id="c8" /> </span></td> <td width="55" align="center" valign="middle" class="style5"><span class="style51"> <input value="1" type="checkbox" name="d8" id="d8" /> </span></td> <td width="55" align="center" valign="middle" class="style5"><span class="style51"> <input value="1" type="checkbox" name="e8" id="e8" /> </span></td> </tr> </table> <br /> <table border="0" cellpadding="0" cellspacing="0"> <tr> <td height="26" class="style51"><strong>9. Would you like to comment on anything else?</strong></td> </tr> <tr> <td height="26" align="center" class="style51"><textarea name="comments" id="comments" cols="35" rows="3" style="border: 1px groove #036B6A; font-family:tahoma; font-size:14px; background:transparent url('http://www.centurysoftware.co.uk/img/field_bg4.gif')"></textarea></td> </tr> </table> <br /> </div><p align="center"> <input name="submit" type="submit" class="style6" id="submit" value="Send Feedback" style="border: 1px groove rgb(0, 0, 0); background:transparent url('http://www.centurysoftware.co.uk/img/button_bg1.jpg'); text-align: center; font-family: tahoma; font-size: 14px; color: rgb(255, 255, 255); font-weight:bold; width:200px"></form> PHP: <?php @extract($_POST); $name = stripslashes($name); $company = stripslashes($company); $email = stripslashes($email); $a1 = stripslashes($a1); $b1 = stripslashes($b1); $c1 = stripslashes($c1); $d1 = stripslashes($d1); $e1 = stripslashes($e1); $a2 = stripslashes($a2); $b2 = stripslashes($b2); $c2 = stripslashes($c2); $d2 = stripslashes($d2); $e2 = stripslashes($e2); $a3 = stripslashes($a3); $b3 = stripslashes($b3); $c3 = stripslashes($c3); $d3 = stripslashes($d3); $e3 = stripslashes($e3); $a4 = stripslashes($a4); $b4 = stripslashes($b4); $c4 = stripslashes($c4); $d4 = stripslashes($d4); $e4 = stripslashes($e4); $a5 = stripslashes($a5); $b5 = stripslashes($b5); $c5 = stripslashes($c5); $d5 = stripslashes($d5); $e5 = stripslashes($e5); $a6 = stripslashes($a6); $b6 = stripslashes($b6); $c6 = stripslashes($c6); $d6 = stripslashes($d6); $e6 = stripslashes($e6); $a7 = stripslashes($a7); $b7 = stripslashes($b7); $c7 = stripslashes($c7); $d7 = stripslashes($d7); $e7 = stripslashes($e7); $a8 = stripslashes($a8); $b8 = stripslashes($b8); $c8 = stripslashes($c8); $d8 = stripslashes($d8); $e8 = stripslashes($e8); $comments = stripslashes($comments); $dbhost = 'localhost'; $dbuser = '***************'; $dbpass = '***************'; $dbname = 'bridgey_centuryfeedback'; $table = 'supportfeedback'; $conn = mysql_connect($dbhost, $dbuser, $dbpass) or die ('Error connecting to database'); mysql_select_db($dbname); @mysql_select_db("$dbname") or die("Error: Unable to select database"); $sqlquery = "INSERT INTO $table VALUES('','','$name','$company','$email','$a1','$b1','$c1','$d1','$e1','$a2','$b2','$c2','$d2','$e2','$a3','$b3','$c3','$d3','$e3','$a4','$b4','$c4','$d4','$e4','$a5','$b5','$c5','$d5','$e5','$a6','$b6','$c6','$d6','$e6','$a7','$b7','$c7','$d7','$e7','$a8','$b8','$c8','$d8','$e8','$comments','','','')"; mysql_close($conn); // redir when sent.... header("Location: http://centurysoftware.co.uk/fbsent.htm"); exit; ?> I am using field 1 in the database for an ID no which should automatically save 000001 to the first record then automatically increment. Field 2 is a timestamp which should update when the record is saved. Fields 3 and beyond are the actual form content, with the last 3 fields left blank as spare fields. I have left gaps in the SQL query for fields I do not want to populate. Perhaps I have done this incorrectly? Quote Link to comment https://forums.phpfreaks.com/topic/170731-solved-why-doesnt-my-survey-record-details-correctly-to-a-mysql-database/#findComment-900789 Share on other sites More sharing options...
trq Posted August 18, 2009 Share Posted August 18, 2009 For starters, you never actually execute your query. Take a look at mysql_query. ps: You really need to escape your data before using it within a query, also take a look at mysql_real_escape_string. Quote Link to comment https://forums.phpfreaks.com/topic/170731-solved-why-doesnt-my-survey-record-details-correctly-to-a-mysql-database/#findComment-900792 Share on other sites More sharing options...
skot Posted August 18, 2009 Author Share Posted August 18, 2009 Was following a tutorial.. guess it wasn't a good one! Will review. Thanks. Quote Link to comment https://forums.phpfreaks.com/topic/170731-solved-why-doesnt-my-survey-record-details-correctly-to-a-mysql-database/#findComment-900793 Share on other sites More sharing options...
skot Posted August 18, 2009 Author Share Posted August 18, 2009 Thanks for advice this is now working almost as expected But! MySQL doesn't record a date/time in the TIMESTAMP field. Do I have to populate this through PHP or can MySQL do it for me? Using phpMyAdmin as database front end. Quote Link to comment https://forums.phpfreaks.com/topic/170731-solved-why-doesnt-my-survey-record-details-correctly-to-a-mysql-database/#findComment-900803 Share on other sites More sharing options...
PFMaBiSmAd Posted August 18, 2009 Share Posted August 18, 2009 It depends on the column definition of your TIMESTAMP column and/or if it is the first TIMESTAMP column or not. Post your table definition. Quote Link to comment https://forums.phpfreaks.com/topic/170731-solved-why-doesnt-my-survey-record-details-correctly-to-a-mysql-database/#findComment-900885 Share on other sites More sharing options...
skot Posted August 23, 2009 Author Share Posted August 23, 2009 I got this working, thanks. Quote Link to comment https://forums.phpfreaks.com/topic/170731-solved-why-doesnt-my-survey-record-details-correctly-to-a-mysql-database/#findComment-904676 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.