eyehawk78 Posted February 7, 2006 Share Posted February 7, 2006 hello, when i try to execute this script i get the error codeParse error: syntax error, unexpected $end in C:\wamp\www\directory\test2.php on line 117basically i just want the submitted form data to be passed into a database. could some offer another set of eyes to look over my code plz?<HTML><HEAD><?phpfunction dbInsert(){if(IsSet($_POST['submit'])){$dbUser="99hawker";$dbHost="localhost";$dbName="tprint";$dbPass="wdh240288";$dbc=mysql_connect($dbHost,$dbUser,$dbPass);$selected=mysql_select_db($dbName,$dbc);$title=$_POST['Title'];$firstname=$_POST['first_name'];$lastname=$_POST['last_name'];$address1=$_POST['address1'];$address2=$_POST['address2'];$towncity=$_POST['towncity'];$countystate=$_POST['countystate'];$country=$_POST['country'];$postcodezip=$_POST['postcodezip'];$emailaddress=$_POST['EmailAddress'];$query1="INSERT INTO Customer_Info VALUES('$title', '$firstname', '$lastname', '$address1', '$address2', '$towncity', '$countystate', '$country', '$postcodezip', '$emailaddress')";if(mysql_query($query1)){print("succesful");}else{print("Failed");}}?></HEAD><BODY><FORM ACTION="<?php echo $_SERVER['PHP_SELF']; ?>" METHOD="POST"><table align="center" border="0" cellpadding="0" cellspacing="0" width="600"><tr valign="top"><tr><td class="topSpacer" width="190"><img alt="" border="0" height="1" width="190"></td><td class="topSpacer" width="6"><img alt="" border="0" height="1" width="6"></td><td class="topSpacer" width="100%"><img alt="" border="0" height="1" width="1"></td></tr><tr><td class="label"><label for="Title">Title:</label></td><td width="6"><img alt="" border="0" height="1" width="6" name="Title"></td><td align="left"><select><option value="Mr">Mr</option><option value="Mrs">Mrs</option><option value="Miss">Miss</option><option value="Dr">Dr</option></select></tr><tr><td class="label"><label for="first_name">First Name:</label></td><td width="6"><img alt="" border="0" height="1" width="6"></td><td align="left"><input type="text" class="textLong" size="25" maxlength="32" name="first_name" value=""></td></tr><tr><td class="label"><label for="last_name">Last Name:</label></td><td width="6"><img alt="" border="0" height="1" width="6"></td><td align="left"><input type="text" id="last_name" class="textLong" size="25" maxlength="64" name="last_name" value=""></td></tr><tr><td class="label"><label for="address1">Address Line 1:</label></td><td width="6"><img alt="" border="0" height="1" width="6"></td><td align="left"><input type="text" id="address1" class="textLong" size="25" maxlength="100" name="address1" value=""></td></tr><tr><td class="label"><label for="address1">Address Line 2:</label></td><td width="6"><img alt="" border="0" height="1" width="6"></td><td align="left"><input type="text" id="address2" class="textLong" size="25" maxlength="100" name="address2" value=""></td></tr><tr><td class="label"><label for="Town/City">Town/City:</label></td><td width="6"><img alt="" border="0" height="1" width="6"></td><td align="left"><input type="text" id="Town/City" class="textLong" size="25" maxlength="100" name="towncity" value=""></td></tr><tr><td class="label"><label for="County/State">County/State:</label></td><td width="6"><img alt="" border="0" height="1" width="6"></td><td align="left"><input type="text" id="County/State" class="textLong" size="25" maxlength="100" name="countystate" value=""></td></tr><tr><td class="label"><label for="Postcode/ZIP">Postcode/ZIP Code:</label></td><td width="6"><img alt="" border="0" height="1" width="6"></td><td align="left"><input type="text" id="Postcode/ZIP" class="textLong" size="25" maxlength="100" name="postcodezip" value=""></td></tr><tr><td class="label"><label for="Country">Country:</label></td><td width="6"><img alt="" border="0" height="1" width="6"></td><td align="left"><select name="country" size="1">(lots of countries)</select></td></tr><tr><td class="label"><label for="EmailAddress">Email Address:</label></td><td width="6"><img alt="" border="0" height="1" width="6"></td><td align="left"><input type="text" id="EmailAddress" class="textLong" size="25" maxlength="100" name="EmailAddress" value=""></td></tr><tr><td class="label"><label for="EmailAddress">Repeat Email Address:</label></td>line 117 <td width="6"><img alt="" border="0" height="1" width="6"></td><td align="left"><input type="text" id="EmailAddress2" class="textLong" size="25" maxlength="100" name="EmailAddress2" value=""></td></table><input TYPE="submit" NAME="submit" VALUE="Proceed" STYLE="font-size:13pt; background-color:#3399FF; color:#000000" onClick="php dbInsert()"></FORM></BODY></HTML>n e help would be greatly appreiciated, cheers Quote Link to comment https://forums.phpfreaks.com/topic/3344-code-error/ Share on other sites More sharing options...
wickning1 Posted February 7, 2006 Share Posted February 7, 2006 It looks like you're a little confused about the difference between Javascript and PHP.Delete the line that says "function dbInsert(){", and remove the onClick="php dbInsert()" from your submit button, and I think you should be fine. Quote Link to comment https://forums.phpfreaks.com/topic/3344-code-error/#findComment-11419 Share on other sites More sharing options...
eyehawk78 Posted February 7, 2006 Author Share Posted February 7, 2006 thanks alot wickning1 that seems to of workedcheers agen Quote Link to comment https://forums.phpfreaks.com/topic/3344-code-error/#findComment-11422 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.