我希望表单将内容发送到我的电子邮件,而不是只是在新窗口中显示我的PHP代码,任何人都可以帮忙吗?这是代码:
索引
<form action="send.php" method="POST">
Name: <br><input type="text" name="name"><br><p>
Request: <br><textarea name="request"></textarea><p>
<input type="submit" name="submit" value="Send!">
</form>
PHP:
<?php
$name = $_POST['name'];
$request = $_POST['request'];
$to = "myemail@email.co.uk";
$subject = "It's just a test";
$body = "This is just a test to see if things are working okay \n\n $request";
mail ($to,$subject,$body);
echo "Message sent!"
?>
答案 0 :(得分:0)
初学者的一些提示
print_r($_POST)