Jump to content

function question

  • Please log in to reply
3 replies to this topic

#1 _*rc69_*

  • Guests

Posted 18 September 2004 - 09:19 PM

if ($_POST['submit']){
   if($_POST['email'] == 'E-mail' || !$_POST['email'] || $_POST['email'] < 5) { 
  die ("Error! : No email entered<br><a href=\"javascript: history.back(-2)\">back</a>");

is there anyway i can get something that checks to see if there is an '@' symbol and a '.' in the $_POST['email'] variable, and if @ or . is not in the variable, then kill the script?

i know you can use str_replace() to look for a specific piece of text, then change it and output a new varialbe, i want to just check an email address box to see if they have it semi-correctly filled out, and if not, the die and give the option to go back

is that even possible?

#2 _*Dabu_*

  • Guests

Posted 18 September 2004 - 10:34 PM

stripos and exit are the answers to your questions young one. Although it woudl be better to use eregi because it is case insensitive and such.

#3 _*Shao_*

  • Guests

Posted 18 September 2004 - 11:03 PM

You might want to bookmark the php site (php.net), especially the manual section as it contains a wealth of info.

#4 _*rc69_*

  • Guests

Posted 19 September 2004 - 12:40 AM

ya... i was looking around and i saw something about php.net, so i decided to see if it had anything good... just so happend it did

strpos() and stristr(), were exactly what i was looking for (i needed both... one for the problem i posted, one for a different problem)

thanks for the advice :P

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users