when i try to run this code i am getting an unexpected else statement error and i can’t seem to figure out why any help would be very much appriciated. It tells me the error is on line 23 which is
[php]
<?php ob_start(); ?> <?php if(empty ($_POST['firstname']) ||empty ($_POST['lastname']) ||empty ($_POST['email'])){ echo "You must fill in your first name, last name and email address.
\n"; echo "Please use your browser's back button to return to the form.
\n"; }//end if empty else { $db_name ="shellytestsite"; $con = @mysql_connect("mysql.shellytestsite.netwalker.us", "shellyingalls", "NaZUG@c+*hEf8"); if ($con===FALSE) { echo "Unable to connect to the database server.
" . "Error code " . mysql_errno() . ": " . mysql_error() ."";} else{ //select the database $db = mysql_select_db($db_name, $con); if($db === FALSE){ echo "Unable to connect to the database server.
" . "Error code " . mysql_errno() . ": " . mysql_error() . "
";} } (Line 23) else { $db_table = "mailinglist"; $first=addslashes($_POST['firstname']); $last=addslashes($_POST['lastname']); $mail=($_POST['email']); $SQLstring="INSERT INTO $db_table(firstname, lastname, email) VALUES('$first, $last, $email)"; $QueryResult=mysql_query($SQLstring,$con); // test if data entered if (!mysql_error($con)) {//if ($QueryResult === TRUE) echo "Your email has been added to our mailing list.
\n"; echo "Thank you.
\n"; } else { echo "Unable to add your information at this time. Please contact support.
\n"; } mysql_close($con); $con = FALSE; }//end if }//end else ?>[/php]