View unanswered posts | View active topics It is currently Tue Nov 20, 2018 3:31 am



Reply to topic  [ 1 post ] 
 Form check & Email validation 
Author Message
Junior Member

Joined: Thu Jul 03, 2003 11:33 am
Posts: 1
Post 
Hi all the PHP heads,

I know its basic but this is doing my head in a bit.

Any help please!
****************************************************

___________
HTML STUFF
___________

Code:
<?php
  if ($submit){
   if (!$email || BLAH || !$eCheck)     
   {
   $error = "Required Fields Missing (*)!";
   $error1 = "(*)";
   }
   else {
   echo "<fieldset><legend>Application Recieved</legend><div align=\"center\"><span class=\"thanx\"><br />Thank you for

your application.<br />We will contact you shortly.<br /><br /></span></div></fieldset><br />";
   }
}
   if (!$submit || $error) {
echo "<div align=\"center\"><span class=\"red\">$error</span></div>";    
?>

____
Form stuff
____
//////////////////////////////////////////////////////////////////////
// Problem lies below somewhere I guess!
// On submit if email is varified
// It doesn't assign the $eCheck variable, until next submit
// Hence you have to enter submit twice
// I am stumped! And been at it for far too long- Any ideas!
// All I wanted to do was validate the form, check the email and submit the page
//////////////////////////////////////////////////////////////////////
Code:
<?php
  if ($email!="" && (!eregi("^[a-z0-9]+([-_\.]?[a-z0-9])+@[a-z0-9]+([-_\.]?[a-z0-9])+\.[a-z]{2,4}", $email))) { echo

"Invalid E-Mail address!";
  }
  if ($email!="" && (eregi("^[a-z0-9]+([-_\.]?[a-z0-9])+@[a-z0-9]+([-_\.]?[a-z0-9])+\.[a-z]{2,4}", $email))) {

$eCheck = "correct";
  }
  ?>

</span>


</span>
</div>
</fieldset>



<input name="eCheck" type="hidden" id="eCheck" value="
Code:
<?php echo $eCheck ?>
" />
___________________
REST OF FORM STUFF
___________________

REST IF THE HTML
___________________

Any help greatly appreciated, cheers

V


Thu Jul 03, 2003 11:36 am
Report this post
Profile
Display posts from previous:  Sort by  
Reply to topic   [ 1 post ] 

Who is online

Users browsing this forum: No registered users and 0 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
© Copyright 2003-2008 www.php-editors.com. The ultimate PHP Editor and PHP IDE site.