Re: how to connect new html page in PHP.
| From: | Zareef Ahmed | Date: | Sat, 25 Dec 2004 08:32:58 +0000 |
| Subject: | Re: how to connect new html page in PHP. | ||
| References: | 1 2 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-37843@lists.php.net to get a copy of this message | ||
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@bankdrt.com \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