I need to know how I can prevent my form-page to insert empty data into my database everytime the page loads.
This is how I setup my simple php-script right before the html-form appears:
$db = mysql_connect("serv","db","psw");
mysql_select_db("db", $db);
mysql_query("INSERT INTO kalender(titel, sted, day, month, year, beskrivelse,
person, kontakt, order_date)
values '$titel', '$sted', '$day', '$month', '$year', '$beskrivelse',
'$person', '$kontakt', '$order_date')");
mail("admin@wow.se","kalender","$titel, $sted, $day, $month,
$year, $person, $kontakt, $order_date");
The page works smooth and inserts the needed data when someone fills out the form and hits the submit-button.
But the problem is that my script also inserts an empty set of data, just when the page is viewed!! 🙁
Very simple, but not working good enough...
U can take a look at the form at www.kor72u.dk/kalender_add.php - but I have disabled the INSERT to prevent fudge...
Need help - thx