如何制作将信息发送到我的电子邮件的提交按钮?

时间:2013-06-07 03:57:47

标签: html

我正在为我的老师做一个调查,以便分发给他们(他不知道我怎么知道,而且我知道的比他更多)

我的问题是我不太熟悉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,我有真正的电子邮件。

谢谢!

3 个答案:

答案 0 :(得分: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'];
?>

答案 1 :(得分:0)

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

另外,您应在enctype="text/plain"中添加form

答案 2 :(得分:0)

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

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

您还可以从here下载此来源并结帐demo