PHP 代码中的错误。仍然在 php 函数 $action = $_REQUEST['action']; 中向我显示此错误“未定义索引:操作”;你能帮我找出解决办法吗?
谢谢你
完整代码在这里:
<?php
$action = $_REQUEST['action'];
if ($action== "") {
?>
<form action="" method="POST" >
Meno*:<br>
<input name="name" type="text" value="" size="30"/><br>
Email*:<br>
<input name="email" type="text" value="" size="30"/><br>
Vaša otázka*:<br>
<textarea name="message" rows="11" cols="80"></textarea><br>
<input type="submit" value="Poslať email"/>
</form>
<?php
}
else /* send the submitted data */
{
$name = $_REQUEST['name'];
$email = $_REQUEST['email'];
$message = $_REQUEST['message'];
if ( ($name=="") || ($email=="") || ($message=="") ) {
echo "Všetky políčka je potrebné vyplniť. Napíšte <a href=\"\"> otázku </a> ešte raz.";
} else {
$from = "From: $name<$email>\r\nReturn-path: $email";
$subject = "Message sent using your contact form";
mail("27phillip@gmail.com", $subject, $message, $from);
echo "Mail poslaný!";
}
}
?>