Code:
//registration.php
<?
$host='localhost';
$username='root';
$password='asd';
$connection = mysql_connect($host,$username,$password);
mysql_select_db("data");
$yearList = mysql_query ("SELECT yrValue FROM admin_dateFormat order by year");
?>
<html>
<title>Registration</title>
<form action="registration.php" method="post" name="register_form" target="_self" id="register_form">
Year
<select name="list_year" id="list_year">
<?
$counter = 0;
while ($row = mysql_fetch_array($yearList)) {
?>
<option value="<? echo $row["yrValue"]; ?>"> <? echo $row["yrValue"];
} ?>
</select>
<input type="submit" name="Submit" value="Submit" >
</form>
</html>
<?
$Year=$_POST['list_year'];
if($Year==null)
{
echo"Please make sure all the required field are being entered or chosen. //year \n";
echo "Please back click to continue.";
}
else
{
mysql_query ("INSERT INTO user values ('$Year')");
mysql_close();}
?>
When even i open it on the browser, the error msg will straight away shown out without even the user clicking on the submit button.
