-3

我正在为我的老师做一个调查,分发给全班(他不知道怎么做,我比他知道的多)

我的问题是我对 HTML 不太熟悉,也不知道如何让我的提交按钮工作。

这是我的代码:

<html>
<h2>
    Please fill this out as feedback.
</h2>
<body>
<form>
<form method="post" action='mailto:example_email@hostname.com'>
<input type="hidden" name="Re" value="survey">
<td>On a scale of 1-10, how well did you understand this tutorial?</td><br>
<td>
    <input type="radio" value="1" name="q1">1
    <input type="radio" value="2" name="q1">2
    <input type="radio" value="3" name="q1">3
    <input type="radio" value="4" name="q1">4
    <input type="radio" value="5" name="q1">5
    <input type="radio" value="6" name="q1">6
    <input type="radio" value="7" name="q1">7
    <input type="radio" value="8" name="q1">8
    <input type="radio" value="9" name="q1">9
    <input type="radio" value="10" name="q1">10
</td>
<br>
<br>
<td>On a scale of 1-10, how much previous knowledge did you have before this tutorial?</td><br>
<td>
    <input type="radio" value="1" name="q2">1
    <input type="radio" value="2" name="q2">2
    <input type="radio" value="3" name="q2">3
    <input type="radio" value="4" name="q2">4
    <input type="radio" value="5" name="q2">5
    <input type="radio" value="6" name="q2">6
    <input type="radio" value="7" name="q2">7
    <input type="radio" value="8" name="q2">8
    <input type="radio" value="9" name="q2">9
    <input type="radio" value="10" name="q2">10
</td>
<br>
<br>
<td>On a scale of 1-10, how comfortable do you think your skills are with the knowledge you learned?</td><br>
<td>
    <input type="radio" value="1" name="q3">1
    <input type="radio" value="2" name="q3">2
    <input type="radio" value="3" name="q3">3
    <input type="radio" value="4" name="q3">4
    <input type="radio" value="5" name="q3">5
    <input type="radio" value="6" name="q3">6
    <input type="radio" value="7" name="q3">7
    <input type="radio" value="8" name="q3">8
    <input type="radio" value="9" name="q3">9
    <input type="radio" value="10" name="q3">10
</td>
<br>
<br>
<td>On a scale of 1-10, how likely are you to ever use HTML again?</td><br>
<td>
    <input type="radio" value="1" name="q4">1
    <input type="radio" value="2" name="q4">2
    <input type="radio" value="3" name="q4">3
    <input type="radio" value="4" name="q4">4
    <input type="radio" value="5" name="q4">5
    <input type="radio" value="6" name="q4">6
    <input type="radio" value="7" name="q4">7
    <input type="radio" value="8" name="q4">8
    <input type="radio" value="9" name="q4">9
    <input type="radio" value="10" name="q4">10
</td>
<br>
<br>
<td>On a scale of 1-10, did you enjoy taking part in this?</td><br>
<td>
    <input type="radio" value="1" name="q5">1
    <input type="radio" value="2" name="q5">2
    <input type="radio" value="3" name="q5">3
    <input type="radio" value="4" name="q5">4
    <input type="radio" value="5" name="q5">5
    <input type="radio" value="6" name="q5">6
    <input type="radio" value="7" name="q5">7
    <input type="radio" value="8" name="q5">8
    <input type="radio" value="9" name="q5">9
    <input type="radio" value="10" name="q5">10
</td>
<br>
<br>
Please include your thoughts, sugestions, or questions here:<BR>
<TEXTAREA NAME="Comments" ROWS="6" COLS="50"></TEXTAREA>
<br>
<br>

<td><input type="submit" value="Send"></td>
</form>
</body>

如果它很乱,我很抱歉,我只是想把它放在一起,我对 HTML 并不是那么好。

在我有 example_email@hostname.com 的地方,我有我的真实电子邮件。

谢谢!

4

3 回答 3

2

首先删除重复的<form>标签。

<form><!-- remove this -->
<form method="post" action='mailto:example_email@hostname.com'>

如果您只是尝试调用用户的电子邮件客户端发送电子邮件,您可以这样做:

<form action='mailto:example_email@hostname.com' method="post" enctype="text/plain">

除此之外,您还需要某种服务器端语言来处理提交的数据。

以下是您可以在 PHP 中执行的操作:

<form method="post" action="survey.php">
<?php
// You can retrieve the values this way. You may want to sanitize the input as well.
$question1 = $_POST['q1'];
$question2 = $_POST['q2'];
$question3 = $_POST['q3'];
$question4 = $_POST['q4'];
$question5 = $_POST['q5'];
$question6 = $_POST['q6'];
$comments  = $_POST['Comments'];
?>
于 2013-06-07T04:07:46.773 回答
0

您的代码中有一些语法错误。您正在使用<form>标签 2 次。您应该删除第一个<form>标签。

你也应该enctype="text/plain"在你的form.

于 2013-06-07T04:07:53.363 回答
0

在这种情况下,我更喜欢 php。在这里,一个很棒的教程。

http://css-tricks.com/sending-nice-html-email-with-php/

您还可以从此处下载此源代码并查看演示

于 2013-06-07T04:13:29.090 回答