I have a form for inserting applications into db and everything is getting posted now. When I test the form on any of my form checks like for empty fields, I get no error message and the field posts blank.
Can someone tell me what I missed here please?
<?php
include("header.php");
include("dbconnect.php");
?>
<?
if(isset($_POST["submit"]))
//set variables for the form post
$nick=$_POST['nick'];
$pwdb=$_POST['pwdb'];
$fname=$_POST['fname'];
$bdaymm=$_POST['bdaymm'];
$bdaydd=$_POST['bdaydd'];
$ovr13=$_POST['ovr13'];
$email=$_POST['email'];
$country=$_POST['country'];
$state=$_POST['abbrev'];
$otherNicks=$_POST['otherNicks'];
$newZone=$_POST['newZone'];
$zoneStatus=$_POST['zoneStatus'];
$plusNick=$_POST['plusNick'];
$referredby=$_POST['referredby'];
$reason=$_POST['reason'];
$coc=$_POST['coc'];
$status=$_POST['status'];
$rank=$_POST['rank'];
//do the form field checks before accepting the post
//certain fields should not be "blank", if certain questions
//are answered NO, then don't process the form
if ($nick=="") {
echo "<p align=center><FONT FACE="Trebuchet MS" COLOR="#e6e6e6" size=3><b>Please enter your current NickName</b></font></p>";
}
elseif ($pwdb=="") {
echo "<p align=center><FONT FACE="Trebuchet MS" COLOR="#e6e6e6" size=3><b>Please enter a password with Max 11 characters</b></font></p>";
}
elseif ($ovr13=='no'){
echo "<p align=center><FONT FACE="Trebuchet MS" COLOR="#e6e6e6" size=3><b>You must be over 13 yrs of age to join this club</b></font></p>";
}
elseif ($email=="") {
echo "<p align=center><FONT FACE="Trebuchet MS" COLOR="#e6e6e6" size=3><b>You MUST enter a Valid email</b></font></p>";
}
// check for duplicate email
$sql="SELECT * FROM players where email='$email'";
$result=mysql_query($sql,$dblink);
$row=mysql_fetch_array($result);
OR if ($email==$row['email']) {
echo "<p align=center><FONT FACE="Trebuchet MS" COLOR="#e6e6e6" size=3><b>You already have an account with us and you can only have 1 account so this Application is rejected</b></font></p>";
}
elseif ($country=="") {
echo "<p align=center><FONT FACE="Trebuchet MS" COLOR="#e6e6e6" size=3><b>Please choose a country</b></font></p>";
}
elseif ($referredby=="") {
echo "<p align=center><FONT FACE="Trebuchet MS" COLOR="#e6e6e6" size=3><b>Please enter the name of who referred you to the club</b></font></p>";
}
elseif ($coc=='no'){
echo "<p align=center><FONT FACE="Trebuchet MS" COLOR="#e6e6e6" size=3><b>We are sorry you do not agree with our Rules but your Application is rejected</b></font></p>";
}
else {
$sql="insert into players (nick,pwdb,joindate,fname,bday,ovr13,email,country,state,otherNicks,newZone,zoneStatus,plusNick,referredby,reason,coc,status,rank) VALUES ('$nick','$pwdb',CURDATE(),'$fname','$bdaymm/$bdaydd','$ovr13','$email','$country','$state','$otherNicks','$newZone','$zoneStatus','$plusNick','$referredby','$reason','$coc','$status','$rank')";
}
$result = mysql_query($sql);{
echo "<p align=center>
<FONT FACE="Trebuchet MS" COLOR="#e6e6e6" size=4><b>Thanks, <? echo $nick;?>";
echo "<p align=center><FONT FACE="Trebuchet MS" COLOR="#e6e6e6" size=4><b>!Your Application has been sent!</b></font></p>";
?>
Thanks in advance,
Barb