Can anyone help me, i have created a registration form, which works and inserts data into mysql,but i need to insert some error message into my script, for example if a user was to leave out a field, a message stating, that they have missed out a field.
here is my script:
<body>
<H1><center>REGISTRATION FORM</H1>
<hr>
<?php
if ($submit) {
// process form
$db = mysql_connect("localhost", "root");
mysql_select_db("Football",$db);
$sql = "INSERT INTO members (username,password,firstname,lastname,address,postcode,country,emailaddress,telno) VALUES ('$username','$password','first','$last','$address','$postcode','$country','$emailaddress','$telno')";
$result = mysql_query($sql);
echo "THANK YOU!\n";
echo "YOUR DETAILS HAVE BEEN SUCCESSFULLY SUBMITTED!\n";
} else{
?>
<form method="post" action="<?php echo $PHP_SELF?>">
Username: <input type="Text" name="username"><center>
<br>
Password: <input type="Text" name="password"><center>
<br>
First name: <input type="Text" name="first"><center>
<br>
Last name: <input type="Text" name="last"><center>
<br>
Address: <input type="Text" name="address"><center>
<br>
Postcode: <input type="Text" name="postcode"><center>
<br>
Country: <input type="Text" name="country"><center>
<br>
Email Address: <input type="Text" name="emailaddress"><center>
<br>
Tel No: <input type="Text" name="telno"><center>
<br>
<br>
<input type="Submit" name="submit" value="SUBMIT FORM">
</form>
<?php
} // end if
?>
<a href ="main.php">BACK TO MAIN PAGE</a>
</body>