编辑:问题已得到解答。只需删除表单中的表单标记即可。谢谢大家的提醒。
让我尽力解释这个问题。 我正在写一个有多个单选按钮组的表单(是的,它们彼此分开)。我尝试传递其值,以便可以通过电子邮件发送,但是当收到电子邮件时,这些值不会显示。第一组(表单id =" gateMats")值被传递,但其他组不会被发送。
这是html代码:
<form id="validGate" method="POST" enctype="multipart/form-data" onsubmit="return validating(this)" action="quotationForm.php">
<table width="730" style="margin: auto";>
<tbody>
<tr>
<td align="right"><b>*</b>Gate Material: </td>
<td><form id="gateMats" action="" onclick="return validateGateMats()">
<input name="material" type="radio" value="Aluminum" id="aluminum"> Aluminum </input>
<input name="material" type="radio" value="Stainless Steel" id="stainlessSteel"> Stainless Steel</input>
</form>
</td>
</tr>
<tr>
<td align="right">Hoist Requirements: </td>
<td><form id="gateHoistReq" action="">
<input name="hoiReq" type="radio" value="Manual" id="manual" onclick="hoist(this)"> Manual </input>
<input name="hoiReq" type="radio" value="Electric" id="electric" onclick="hoist(this)"> Electric</input>
</form>
</td>
</tr>
<tr id="hoistType" style="display: none;">
<td align="right">Hoist Type: </td>
<td><form id="gateHostTy" action="">
<input type="radio" name="hoiTyp" id="handwheel" value="Handwheel"> Handwheel </input>
<input type="radio" name="hoiTyp" id="gearbox" value="90 Degree Gearbox"> 90° Gearbox</input>
</form>
</td>
</tr>
<tr>
<td align="right"><p>
</p></td>
<td><p>
</p></td>
</tr>
<tr>
<td align="right">Stem Cover: </td>
<td><form id="gateStemCo" action="">
<input type="radio" value="Clear Plastic" name="stCov" id="clearPlastic"> Clear Plastic </input>
<input type="radio" value="Metal" name="stCov" id="metal"> Metal</input>
</form>
</td>
</tr>
<tr>
<td align="right">Type of Stem: </td>
<td><form id="gateStemTy" action="">
<input type="radio" value="Rising Stem" name="stType" id="RisingStem">Rising Stem </input>
<input type="radio" value="Non-Rising Stem" name="stType" id="nonRisingStem">Non-Rising Stem </input>
<input type="radio" value="Downard Opening(Weir)" name="stType" id="downwardOpening">Downward Opening (Weir)</input>
</form>
</td>
</tr>
</tbody>
</table>
</form>
这里是php代码:
<?php
if ($_SERVER['REQUEST_METHOD']=="POST"){
//Variables.
$user_gateMat = $_REQUEST['material'];
$hoiReq = $_REQUEST['hoiReq'];
$hoiTy = $_REQUEST['hoiTyp'];
$stCov = $_REQUEST['stCov'];
$stTy = $_REQUEST['stType'];
//Body of the email to be sent.
$body_mail = "Gate Details:
Gate material type: $user_gateMat
Hoist required: $hoiReq
Hoist type: $hoiTy
Stem cover: $stCov
Stem type: $stTy
//Everything okay? send the e-mail.
mail("alavarrandomity@gmail.com",'Gate Style',"$body_mail","from:SynTum");
echo "Your email was sent! Thank you.";
}
?>
我对php有一个基本的把握,在看了大约2-3个小时的代码后,很难说出问题是什么。
答案 0 :(得分:1)
一些想法:
(1)正如mulder指出的那样,<form>
<form>
个
(2)交换div的内部形式。
(3)在quotationForm.php
中,不是直接发送电子邮件,而是首先将接收的数据打印到屏幕上(即构建一个接收数据以DIV或输入元素或其他形式显示的aq&amp; d页面)。
(4)您忘记关闭$body
变量。