Thanks so much, that was very helpful. I added the code you suggested to create and display the random number - I called it "vollink" and that worked fine. Then I added the hidden field toward the bottom of the form - it shows at line 311 when I do a "View Source in Int Explorer and then tried adding the code to add it to the table and when I tested it failed with "You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ')' at line 1" . The test version of the page is here www.hollisterairshow.com/volunteerapp2.php . The changes I made to add it to the table is shown below , I must be missing something blindingly obvious, if you could suggest a fix I'd really appreciate it. I did add the field to the MySQL table also.
Thanks again
Tony
$editFormAction = $_SERVER['PHP_SELF'];
if (isset($_SERVER['QUERY_STRING'])) {
$editFormAction .= "?" . htmlentities($_SERVER['QUERY_STRING']);
}
if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "form1")) {
$insertSQL = sprintf("INSERT INTO volunteers (firstname, lastname, email, thursday, friday, saturday, sunday, monday, activity, talents, specialrequests, tshirt, phone, street, city, st, zip, updatedby, vollink) VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, $s)",
GetSQLValueString($_POST['firstname'], "text"),
GetSQLValueString($_POST['lastname'], "text"),
GetSQLValueString($_POST['email'], "text"),
GetSQLValueString($_POST['thursday'], "text"),
GetSQLValueString($_POST['friday'], "text"),
GetSQLValueString($_POST['saturday'], "text"),
GetSQLValueString($_POST['sunday'], "text"),
GetSQLValueString($_POST['monday'], "text"),
GetSQLValueString($_POST['activity'], "text"),
GetSQLValueString($_POST['specialtalents'], "text"),
GetSQLValueString($_POST['specialrequests'], "text"),
GetSQLValueString($_POST['tshirt'], "text"),
GetSQLValueString($_POST['phone'], "text"),
GetSQLValueString($_POST['street'], "text"),
GetSQLValueString($_POST['city'], "text"),
GetSQLValueString($_POST['st'], "text"),
GetSQLValueString($_POST['zip'], "text"),
GetSQLValueString($_POST['vollink'], "text"),
GetSQLValueString($_POST['lastname'], "text"));
mysql_select_db($database_adminconnection, $adminconnection);
$Result1 = mysql_query($insertSQL, $adminconnection) or die(mysql_error());
In your code, you have:
VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, $s)",
Change the $s to %s and that should fix the problem for you.
Let me know. Thanks!
Chad