Greeting to all. I have persistant unsolved problem. In my website I have a form that works fine:
Code:
<form method="POST" name="contactform" action="http://blablabla.com/contact.php">
<input type="text" size="18" maxlength="45">
<textarea name="message" rows="4" cols="25" size="18">
</textarea>
<p>
<input type="submit" value="Send" name="submit">
<input type="reset" value="Clear" name="submit">
</p>
</form>
In my .php I have this which works fine:
PHP Code:
<?php
$myemail = 'blabla@blabla.com';
error_reporting(0);
$message = $_POST['message'];
$email = trim($_POST['email']);
$Ok = ereg("^([a-zA-Z0-9_\.-]+)@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.)|(([a-zA-Z0-9\-]+\.)+))([a-zA-Z]{2,4}|[0-9]{1,3})(\]?)$", $email);
if ($Ok) {
$to = $myemail;
$email_subject = "Contact Form blblblbaa.com.";
$email_body = "Email: $email \n Message: $message";
$headers = "From: $email\n";
$headers .= "Reply-To: $myemail";
mail($to,$email_subject,$email_body,$headers);
if(!ereg("^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,3})$",$UNameFrm))
{
?>
[B]<script language = 'javascript'>
alert('Thank you.');
history.go(-1);
</script>[/B]
<?
exit();
}
}
else {
if(!ereg("^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,3})$",$UNameFrm))
{
?>
[B]<script language = 'javascript'>
alert('Please provide a valid email.');
history.go(-1);
</script>[/B]
<?
exit();
}
}
?>
Can you please help me get rid of the pop up windows created by the alerts in the .php? It would be much better if everything happens on the page.
Thank you for your time and help.
Bookmarks