Jump to content

help with displaying error


dadamssg

Recommended Posts

im creating a register script and don't know how to check to see if theres anything in the array and then if so display the contents..heres a piece of what i have. I think i need to go about seeing if $messages is set a diff way. thanks

 

//////Validate each//////
if(!eregi("^[A-Za-z0-9' -]{8,14}$",$_POST['username']))
{
$messages[]="Username must only be letters and numbers and have at least eight characters.<br>";
}

if($_POST['password'] != $_POST['cpassword'])
  {
  $messages[]= "Your passwords must match.<br>";
  }
  
if(!eregi("^[A-Za-z' -]{3,20}$",$_POST['firstname']))
  {
  $messages[]= "{$_POST['firstname']} is not a valid name.<br>";
  }
  
if(!eregi("^[A-Za-z' -]{3,20}$",$_POST['lasstname']))
  {
  $messages[]= "{$_POST['lastname']} is not a valid name.<br>";
  }

  


if(isset($messages[]))
   {
   extract($_POST);
   include("register_form.php");
   exit();
   }

Link to comment
https://forums.phpfreaks.com/topic/149340-help-with-displaying-error/
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.