TY_BCS_PHP_SLIP 23_2





Slip no. 23. Write a PHP script to design a form to compose/write an email with following details.




 
 
TO



 
 
Subject



 
 


Message



Send Mail
 
 
                                                                                                                                                          



<html>
<head>
<title>HTML email</title>
</head>
<body>
<form action=slip23_2.php>
<table border=1>
<tr><td>To<input type=text name=to></td></tr>
<tr><td>subject<input type=text name=sub></td></tr>
<tr>
<td>Message<input type=textarea name=msg></td></tr>
<tr>
<td><input type=submit value="SEND MAIL"></td>
</tr>
</table>
</form>
</body>
</html>

PHP file :
<?php
$to = $_GET['to'];   
 $subject =  $_GET['sub'];   
$message =  $_GET['msg'];
mail($to,$subject,$message);         // Always set content-type when sending HTML email
?>

No comments:

Post a comment

Note: only a member of this blog may post a comment.