kickstart Posted March 7, 2009 Share Posted March 7, 2009 I have edited this part of my script: $cerror = count($error); if ($cerror > 1 ) { echo $error;?> <FORM><INPUT TYPE="BUTTON" VALUE="Fix Errors" ONCLICK="history.go(-1)"></FORM> <?php } else { and now I am not receiving no errors I click submit with no input field and it just gives me a white page. That is because $cerror is the result of count($error), and count returns 1 if the variable it is passed is not an array and has been set. As it has been assigned "" it has been set, so $cerror will ALWAYS be 1, whether there is an error or not, hence you will never deal with the errors. Try this <?php include 'db.php'; $error = ''; session_start(); if(isset($_SESSION['LOGGEDIN'])==TRUE){ echo'You are already a member ';} if(isset($_POST['apply'])) { if (!$_POST['fname']){ $error .='No First name<br>'; } if (!$_POST['lname']){ $error .='No Last name<br>'; } if (!$_POST['email']){ $error .='No Email Address<br>'; } if (!$_POST['vatsimid']){ $error .='No VATSIM ID<br>'; } if (!$_POST['hub']){ $error .='No Hub<br>'; } if (!$_POST['pwd']){ $error .='No Password<br>'; } if (!$_POST['pwdc']){ $error .='No Password Conformation<br>'; } if (!$_POST['emailc']){ $error .='No Conformation Email Address<br>'; } if ($_POST['thours']){ if (!$_POST['thoursc']){ $error .='No comments<br>'; }} if ($_POST['email'] != $_POST['emailc']){ $error .='Email mismatch'; } if ($_POST['pwd'] != $_POST['pwdc']){ $error .='Password mismatch'; } if (!empty($error)) { echo $error;?> <FORM><INPUT TYPE="BUTTON" VALUE="Fix Errors" ONCLICK="history.go(-1)"></FORM> <?php } else { $fpwd= $_POST['pwd']; $pwd = md5($fpwd); $fname = $_POST['fname']; $lname = $_POST['lname']; $email = $_POST['email']; $pilotl= mysql_query("SELECT * FROM `pilots` WHERE hub='$_POST[hub]' ORDER BY login DESC LIMIT 1") or die(mysql_error()); $plrows = mysql_num_rows($pilotl); if ($plrows=="0") { if ($_POST['hub']=="KPDX") { $login = "1000"; } if ($_POST['hub']=="KLAX") { $login = "2000"; } if ($_POST['hub']=="PANC") { $login = "3000"; } if ($_POST['hub']=="KSEA") { $login = "4000"; } } else { if(empty($error)) { while($plr = mysql_fetch_array($pilotl)) { $login = $plr[login]; } $login = $login + 1; $update = mysql_query("INSERT INTO `pilots` (login,pwd,fname,lname,email,hub,thours,thoursc,rating,vatsimid,date,ip,status,hm,ed,bm,active) VALUES ('$login','$pwd','$_POST[fname]','$_POST[lname]','$_POST[email]','$_POST[hub]','$_POST[thours]','$_POST[thoursc]','First Officer','$_POST[vatsimid]','$now','$ip','0','0','0',0,0)") or die(mysql_error()); $jto = "[email protected]"; $jsubject = "A new pilot has signed up"; $jjmessae = " A new pilot ($fname $laname) with the pending ID of ($login) has submitted an Applications with Simulated Alaska. Please activate their test. "; $from = "[email protected]"; $jheaders = "From: $from"; mail($jto, $jsubject, $jmessage, $jheaders); $jto = "email"; $jsubject = "A new pilot has signed up"; $jjmessae = " A new pilot ($fname $laname) with the pending ID of ($login) has submitted an Applications with --------. Please activate their test. "; $from = "email"; $jheaders = "From: $from"; mail($jto, $jsubject, $jmessage, $jheaders); $to = "$email"; $subject = "RE:------ Application ($fname $lname)"; $messae = " Dear ($fname $lname), We have reccevied your application for membership with -----. You will reccevie another email within 24-48 hours regarding your entry exam. It is really importaint that you complete this exam ASAP. In order to have a membership account with Simulated Alaska you MUST pass this exam with an 80%. So in the meantime please look at the SOP's, explore the site, and study basic aircraft Maneuvers. The exam will cover(Simulated Alaska Operations, Basic Aircraft Maneuvers, and Basic Flying Skills. Once you have pass this test you will then recceive another email saying you have been accepted. Sincerly, -------- "; $from = "email"; $headers = "From: $from"; mail($to, $subject, $message, $headers); echo'<b>Application Sent ------- Staff</b>'; } } } } ?> All the best Keith Link to comment https://forums.phpfreaks.com/topic/148174-not-working/page/2/#findComment-778791 Share on other sites More sharing options...
btherl Posted March 8, 2009 Share Posted March 8, 2009 oops, let me think about that.. Link to comment https://forums.phpfreaks.com/topic/148174-not-working/page/2/#findComment-779239 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.