-1

有人可以帮助我尝试通过电子邮件从我的表格中通过电子邮件发送 4 个单选框的结果。我收到电子邮件很好,但没有收到通过发送的结果。

有人可以告诉我我做错了什么吗?

html表单:

<html>
<head>
<title>Site Feedback</title>
</head>
<body>
<form name="myform" action="send_feedback.php" method="POST">
<div  class="wrapper_feedback" align="left">
  <p>Website Design:</p>
    <input type="radio" name="design" value="design1"> 
    1
    <input type="radio" name="design" value="design2"> 
    2
    <input type="radio" name="design" value="design3" checked> 
    3
     <input type="radio" name="design" value="design4"> 
    4
     <input type="radio" name="design" value="design5"> 
    5
  </p>
  <hr>
<p>Ease of Use:</p>
    <input type="radio" name="easeuse" value="ease1"> 
    1
    <input type="radio" name="easeuse" value="ease2"> 
    2
    <input type="radio" name="easeuse" value="ease3" checked> 
    3
     <input type="radio" name="easeuse" value="ease4"> 
    4
     <input type="radio" name="easeuse" value="ease5"> 
    5
  </p>
    <hr>
<p>Fit for Purpose:</p>
    <input type="radio" name="purpose" value="purpose1"> 
    1
    <input type="radio" name="purpose" value="purpose2"> 
    2
    <input type="radio" name="purpose" value="purpose3" checked>
    3     
    <input type="radio" name="purpose" value="purpose4"> 
    4
     <input type="radio" name="purpose" value="purpose5"> 
    5
  </p>
      <hr>
<p>Layout:</p>
    <input type="radio" name="layout" value="layout1"> 
    1
    <input type="radio" name="layout" value="layout2"> 
    2
    <input type="radio" name="layout" value="layout3" checked>
    3     
    <input type="radio" name="layout" value="layout4"> 
    4
     <input type="radio" name="layout" value="layout5"> 
    5
   </p>
   <input type="submit" action="submit" value="submit" name="submit">
  <br>
</div>
</form>
</body>
</html>

php:

<?php ob_start(); ?>
<?php
/* Set e-mail recipient */
$myemail  = "info@mydomain.com";

$subject = "site Feedback";

/* Let's prepare the message for the e-mail */
$message = "somesite.com Feedback

$design
$easeuse
$purpose
$layout

End of message
";

/* Send the message using mail() function */
mail($myemail, $subject, $message);

/* Redirect visitor to the thank you page */
$_SESSION['feedback']="<div class=\"infobox-index\"><strong>Thank You</strong> - We appreciate you taking the time to tell us what you think.</div>"; 
header("Location: {$_SERVER['HTTP_REFERER']}");
exit();
?>
<?php ob_end_flush() ?>
4

3 回答 3

1

您的代码依赖于已弃用和不鼓励的Register Globals 。您应该通过以下方式访问数据:

$_POST['design']

不是:

$design
于 2013-02-18T17:05:35.017 回答
0

而不是这些变量:

$design
$easeuse
$purpose
$layout

用这个:

$_POST['design']
$_POST['easeuse']
$_POST['purpose']
$_POST['layout']
于 2013-02-18T17:05:59.260 回答
0

您需要使用以下语法访问从表单发送的 POST 变量:

$_POST['design']
$_POST['easeuse']
$_POST['purpose']
$_POST['layout']
于 2013-02-18T17:06:33.627 回答