Jump to content

New to PHP and need help with Validation email collector


shannown

Recommended Posts

I am new to PHP so if this doesn't make sense please for give...

I am using this following code to validate an email that is entered into my header which will collect it in text file and email the client.

// Validation

if (! ereg('[A-Za-z0-9_-]+\@[A-Za-z0-9_-]+\.[A-Za-z0-9_-]+', $email))

{

die("<p align='center'><font face='Arial' size='3' color='#FFFFFF'>Please enter a valid email</font></p>");

}

 

if (strlen($email) == 0 )

{

die("<p align=\"center\"><font face=\"Vrinda\" size=\"4\"color=\"#FFFFFF\">email is empty </font></p>");

}

 

I want to know if instead of using the "die("<p align='center'><font face='Arial' size='3' color='#FFFFFF'>Please enter a valid email</font></p>");" to have text pop up - is there code to call up a .php page instead of text? When I use "include" code it will always go to that page even if a correct email is placed.

 

Here is my goal - when someone types in either a bad emial or no email and hits submit they will be taken to a page which looks the same but with a different header.php file (novalidemail.php) When they retype their correct email address it will place it in my .txt file as well in an email to me. I am using the following script:

# ----- eMail Collector

# ----- Version 2.2

# ----- Created on: 01/25/07

# ----- Designed by: American Financing

# ----- http://www.americanfinancing.net

 

Any ideas?? did that make sense???

Sorry, I'm real green to this.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.