- Code: Select all
<form
action="test.php"
method= "post">
Name: <input type="text" name="fname" />
<input type="submit" value = "Send"/>
</form>
- Code: Select all
<?php
$to = "nm@mail.com";
$subject = "test.";
$message = $_POST["fname"];
$headers = "From: $from";
mail($to,$subject,$message,$headers);
echo "Your request has been sent.";?>
What I would like to do is have the server send an e-mail whenever a client visits a particular page. So basically I want to pass the name of the page as a string to the server and have the server e-mail that string. How do I do that?


