Hi, 

 A simple example of the code. It send email and when it sends email
it does not display the original form.

Please note the use of isset() and submit button name use.

zareef ahmed 

<?php
if(isset($_POST['sendmail']))
{
$to=$_POST['to'];
$sub=$_POST['sub'];
$message=$_POST['message'];

$header="from:[EMAIL PROTECTED] \n\r\n\r";


if(mail($to,$sub,$message,$header))
{
echo "Mail successfully sent";
echo "<br><br> <a href='http://www.bankdrt.com/mail_test.php'>Test Again</a>";
}else
{
echo "Mail function fail";
}


}
else
{
?>

<form method="post" action="<?php $_SERVER['PHP_SELF']; ?>">
To :: <input type="text" name="to" size="30">
<br>
Subject :: <input type="text" name="sub" size="50">
<br>
Message <br>
<textarea name="message" rows="8" cols="50">

</textarea>
<br><br>
<input type="submit" name="sendmail" value="send">
</form>
<br><br>
<?php
}
?>



-- 
Zareef Ahmed :: A PHP Developer in India ( Delhi )
Homepage :: http://www.zareef.net

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to