Php 未传递表单字段
有人能帮我填一下这页的表格吗?表单字段未传递给表单处理程序:。我从我的表单收到一封包含所有表单标签的电子邮件,但字段为空 以下是每页的代码: referrals.phpPhp 未传递表单字段,php,jquery,html,forms,Php,Jquery,Html,Forms,有人能帮我填一下这页的表格吗?表单字段未传递给表单处理程序:。我从我的表单收到一封包含所有表单标签的电子邮件,但字段为空 以下是每页的代码: referrals.php <p><?php $ipi = getenv("REMOTE_ADDR"); $httprefi = getenv ("HTTP_REFERER"); $httpagenti = getenv ("HTTP_USER_AGENT"); ?>
<p><?php
$ipi = getenv("REMOTE_ADDR");
$httprefi = getenv ("HTTP_REFERER");
$httpagenti = getenv ("HTTP_USER_AGENT");
?>
<input type="hidden" name="ip" value="<?php echo $ipi ?>" />
<input type="hidden" name="httpref" value="<?php echo $httprefi ?>" />
<input type="hidden" name="httpagent" value="<?php echo $httpagenti ?>" /></p>
<form method="post" action="sendmail.php">
<h3>Client Information:</h3>
<label for="attn" class="label">Referral To:</label>
<select id="attn" name="select">
<option value="General">General</option>
<option value="Dr. Tammie Ricci, C.Psych.">Dr. Tammie Ricci, C.Psych.</option>
<option value="Dr. Paul Mendella, C.Psych.">Dr. Paul Mendella, C.Psych.</option>
<option value="Dr. Paul Roy, Psychiatrist">Dr. Paul Roy, Psychiatrist</option>
</select>
<br />
<label for="cname" class="label">Client Name:</label>
<input id="cname" type="text" name="textfield" maxlength="60">
<br />
<label for="caddress" class="label">Client Address:</label>
<input id="caddress" type="text" name="textfield" maxlength="60">
<br />
<label for="ccity" class="label">Client City:</label>
<input id="ccity" type="text" name="textfield" maxlength="50">
<br />
<label for="cprovince" class="label">Client Province:</label>
<select id="cprovince" name="select">
<option value="NFLD">NFLD </option>
<option value="NS">NS </option>
<option value="PEI">PEI </option>
<option value="NB">NB </option>
<option value="PQ">PQ </option>
<option value="ON">ONT </option>
<option value="MAN">MAN </option>
<option value="SASK">SASK </option>
<option value="ALTA">ALTA </option>
<option value="BC">BC </option>
<option value="YT">YT </option>
<option value="NWT">NWT </option>
<option value="NVT">NVT </option>
</select>
<br />
<label for="cpcode" class="label">Client Postal Code:</label>
<input id="cpcode" type="text" name="textfield" maxlength="7">
<br />
<label for="chphone" class="label">Client Home Phone:</label>
<input id="chphone" type="text" name="textfield" maxlength="15">
<br />
<label for="cwphone" class="label">Client Work Phone:</label>
<input id="cwphone" type="text" name="textfield" maxlength="15">
<br />
<label for="ccphone" class="label">Client Cell Phone:</label>
<input id="ccphone" type="text" name="textfield" maxlength="15">
<br />
<label for="cdob" class="label">Client Date of Birth</label>
<input id="cdob" type="text" name="textfield" maxlength="20">
<br />
<label for="chmessage" class="label">Can we leave a message at the client's home?</label>
<select id="chmessage" name="select">
<option value="Yes">Yes </option>
<option value="No">No </option>
</select>
<br />
<label for="cwmessage" class="label">Can we leave a message at the client's workplace?</label>
<select id="cwmessage" name="select">
<option value="Yes">Yes </option>
<option value="No">No </option>
</select>
<br />
<br />
<h3>Referral Information</h3>
<label for="rname" class="label">Referral Name:</label>
<input id="rname" type="text" name="textfield" maxlength="60">
<br />
<label for="raddress" class="label">Referral Address:</label>
<input id="raddress" type="text" name="textfield" maxlength="60">
<br />
<label for="rcity" class="label">Referral City:</label>
<input id="rcity" type="text" name="textfield" maxlength="50">
<br />
<label for="rprovince" class="label">Referral Province:</label>
<select id="rprovince" name="select">
<option value="NFLD">NFLD </option>
<option value="NS">NS </option>
<option value="PEI">PEI </option>
<option value="NB">NB </option>
<option value="PQ">PQ </option>
<option value="ON">ONT </option>
<option value="MAN">MAN </option>
<option value="SASK">SASK </option>
<option value="ALTA">ALTA </option>
<option value="BC">BC </option>
<option value="YT">YT </option>
<option value="NWT">NWT </option>
<option value="NVT">NVT </option>
</select>
<br />
<label for="rpcode" class="label">Referral Postal Code:</label>
<input id="rpcode" type="text" name="textfield" maxlength="7">
<br />
<label for="rwphone" class="label">Referral Work Phone:</label>
<input id="rwphone" type="text" name="textfield" maxlength="15">
<br />
<label for="remail" class="label">Referral E-Mail:</label>
<input id="remail" type="text" name="textfield" maxlength="80">
<br />
<label for="notes" class="label">Notes:</label>
<textarea id="notes" style="width: 300px; height: 150px;" name="textarea"></textarea>
<br />
<br />
<p><input type="submit" value="Send Form" /></p>
您需要在sendmail.php中使用$\u POST
或$\u REQUEST
定义变量:
$remail = $_REQUEST['remail'];
要查看您有哪些变量,还可以在sendmail.php上使用以下代码
foreach($_REQUEST as $k => $v)
echo "$k = $v\n";
是否缺少结束表单标记?ip
、httpref
和httpagent
都在表单标记之外。您没有设置发布的值-$\u POST['…]
您没有在PHP脚本中获得任何值,因为您没有在$message
中定义变量。。。尝试使用$\u POST['input\u name']
从表单中获取值(对于表单中的每个输入),是否查看了$\u POST,以查看它在sendmail.php开头是否有任何内容?我相信$\u POST采用的是输入的“名称”值,而不是您正在使用的ID。您的表单元素名称不正确-
,
。name=
不应该是输入类型,而是一个唯一的名称,您可以通过$\u POST
在运行代码时它对我很有效。你能把你的最新资料发送出去吗?
$remail = $_REQUEST['remail'];
foreach($_REQUEST as $k => $v)
echo "$k = $v\n";