Re: how to connect new html page in PHP.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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:info@xxxxxxxxxxx \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


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux