So here is the deal. I have looked around everywhere, and all other techniques relate to refreshing the browser, and methods to prevent the php page from resubmitting the post data. I am new to this (obviously :p) But anyways, my questions I believe is simple. I just want a method, possibly an if else statement that would check the post data entries, and if there is a match already in my table, than do not execute the query. I am not worried about querying all of the results of the table, as I only suspect this table will ever have 50-60 entries.
Here is the php page that handles the form submission:
$firstName = $_POST['firstName']; $lastName = $_POST['lastName']; $email = $_POST['email']; $city = $_POST['city']; $state = $_POST['state']; $submitDate = date("Y-m-d"); mysql_connect ("localhost", "abc", "123") or die ('Error: ' . mysql_error()); mysql_select_db ("members"); $query = "INSERT INTO persons (ID, firstName, lastName, email, city, state, submitDate)VALUES ( 'NULL', '".$firstName."', '".$lastName."', '".$email."', '".$city."', '".$state."', '".$submitDate."' )"; mysql_query($query) or die ('Error Updating database'); echo "Database Updated With: " .$firstName ." " .$lastName ." " .$email ." " .$city ." " .$state; mysql_close($con);
Sorry, cant ever seem to get my php to format correctly with those code braces. Anyways. just to re-iterate, looking for a way to maybe based on the first and last name. if those already exist, then do not allow the submission of the data. I have tried a few if then statements but i do not think I am getting the concept down of comparing the result to my query. I hope this all makes sense!!!