Jump to content

Something Wrong...


phpSensei

Recommended Posts

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

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.