Jump to content

[SOLVED] Break out of If Statement


maxudaskin

Recommended Posts

does seem alittle strange breaking out of an if.

 

you use a if to test if something is correct. then it does something. if something isn't correct, then you use a else. or. you just use the if by itself.

 

so if you dont want the script to die. The if should return false and never execute. hence, why would you need to break the if?

<?php
if(isset($_POST['login'])){ // If Login Form was Sent
  if(empty($_POST['user'])){
     echo "You have not provided a username.";
  }
  if(empty($_POST['pass'])){
     echo "You have not provided a password.";
  }
  // If user or pass are empty, exit if statement
   // More code including if statements
}
?>

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.