PHP pop up for thanks

I’m doing a form using PHP coding. I’d like to know if this is possible.

I’d like a Microsoft pop to show a “thank you” message or “error” message when the form is submitted rather than forwarding to a thankyou or error page. Is this possible using PHP.

steps:

  1. Fill in email
  2. submit button pressed
  3. if email is invalid, an error message pops up
  4. if email is valid, a thank you message pops up
  5. email is sent
  6. auto response is sent to email address

Here’s my code:

<?

//Declare the variables
$siteaddress ="http://www.webaddress.com"; 
$sitename = "eslbuzzCANADA"; 
$adminaddress = "[email protected]";
$subject = "SIGN UP";



//Gets date and time from server
$date = date("m/d/Y H:i:s");

// Gets the IP Address
if ($REMOTE_ADDR == "") $ip = "no ip";
else $ip = getHostByAddr($REMOTE_ADDR);

//Contents of form


//////////////////////////////////////////////////////////////////

//HERE IS THE VALIDATION, WHAT DO I CHANGE TO CREATE THE POP UPS?

 $email = $_REQUEST['email'] ;


  if (!isset($_REQUEST['email'])) {
    header( "Location: http://www.webaddress.com/thankyou.htm" );
  }
  elseif (empty($email)) {
    header( "Location: http://www.webaddress.com/error.htm" );
}
  elseif (!strpos($email,"@")>0) {
    header( "Location: http://www.webaddress.com/error.htm" ); 
  }
  else {
    
    header( "Location: http://www.webaddress.com/thankyou.htm" );	

/////////////////////////////////////////////////////////////////////
//mail() function sends the mail

	mail ("$adminaddress","Info Request",
	"A visitor at $sitename has left the following information
 
	Email: $email

	The visitor has subscribed to the NEWSLETTER.
	------------------------------

	
	Logged Info :
	------------------------------
	Using: $HTTP_USER_AGENT
	Hostname: $ip
	IP address: $REMOTE_ADDR
	Date/Time:  $date","FROM:$adminaddress" ) ; 



//This sends a confirmation to your visitor
mail ("$email","Thank You for visiting $sitename", 
	"Hi $email,

	Thank you for your interest in $sitename!
 
	You have just subscribed to the webaddress.com newsletter.

	Thanks again!!

	$sitename
	CHANGING THE WORLD ONE TEACHER AT A TIME!

	$siteaddress
	$adminaddress", "FROM:$adminaddress") ; 

}
//This line sends to thankyou page when finished

?>

and here is the code in my html


<form action="form.php" method=POST >
            <p>
              <input type=text name=email>
            </p>
            <p>
              <input name="submit" type="submit" id="submit" value="Submit">
            </p>
          </form>

Thank you in advance for any help.