phpSensei Posted August 5, 2007 Share Posted August 5, 2007 I had a script which takes the information from a form and everything worked until I put the insert query thing, and then I tried to undo my work, but now everytime you submit the form no error message of anything comes up. I looked in my page source and the message is there but not on the page, and no the text is not white lol case'confirmregistration': <?php $username=$_POST['usr_name']; $password=md5($_POST['usr_password_1']); $password2=md5($_POST['usr_password_2']); if(empty($_POST['b-day']) || empty($_POST['address']) || empty($_POST['postal_zip']) || empty($_POST['usr_name']) || empty($_POST['usr_password_1']) || empty($_POST['usr_password_2']) || empty($_POST['secret_answer'])){ $stat="bad"; die( '<center><span class="style16">You Left Some Empty Fields,' . ' <a href="register.php">Please go Back</a></span></center>'); } elseif($_POST['country'] == 1){ die( '<center><span class="error">Please Choose a country,' . ' <a href="register.php">Please go Back</a></span></center>'); } elseif(strlen($_POST['usr_name']) >= 31 ){ die( '<center><span class="error">Username Can\'t be more than 30 chars,' . ' <a href="register.php">Please go Back</a></span></center>'); } elseif($password <> $password2 ){ die( '<center><span class="error">Password don\'t match,' . ' <a href="register.php">Please go Back</a></span></center>'); } elseif(strlen($_POST['secret_answer']) <= 4){ die( '<center><span class="error">Your Secret Answer Can\'t be less than 5 chars,' . ' <a href="register.php">Please go Back</a></span></center>'); } break; ?> Link to comment https://forums.phpfreaks.com/topic/63432-something-wrong/ Share on other sites More sharing options...
Utech22 Posted August 5, 2007 Share Posted August 5, 2007 case'confirmregistration': Is is Cas you want to use to check the condition? Try remove the break; Link to comment https://forums.phpfreaks.com/topic/63432-something-wrong/#findComment-316246 Share on other sites More sharing options...
cooldude832 Posted August 5, 2007 Share Posted August 5, 2007 your logic is very poor if/elseif (and a switch if its greater than 2 cases) are not meant to be used to compare muliple variables in different views i.e <?php $a = 1; $b = 2; if($a =1){//Case 1} elseif($b=2){//case 2} else{//case3} ?> this is poor design because case 1 is not relative to case 2 at all secondly whats the break for? Link to comment https://forums.phpfreaks.com/topic/63432-something-wrong/#findComment-316263 Share on other sites More sharing options...
phpSensei Posted August 5, 2007 Author Share Posted August 5, 2007 I took a piece of my code, which I used for a switch statement Thankyou for your help. Link to comment https://forums.phpfreaks.com/topic/63432-something-wrong/#findComment-316313 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.