[英]Form data not passing to PHP
I have what should be a simple form to pass data to a php page. 我有什么应该是将数据传递到php页面的简单形式。 The form is:
形式是:
<form action="php/setlist.php" method="post">
<input type="text" id="SetListName" />
<input type="hidden" id="newList" name="newList" value="" readonly="readonly" style="border: none;">
<input type="submit" style="width:150px;"><br /><br />
and the php is: 和PHP是:
$SetListSave = $_REQUEST['newList'];
$SetListName= $_REQUEST['SetListName'];
echo $SetListName;
echo $SetListSave;
I am getting the newList from the form just fine but the SetListName isn't getting passed. 我从窗体中获取newList很好,但是没有传递SetListName。 I am a novice with php so I could be missing something basic here, but I am stumped.
我是php的新手,所以我在这里可能会缺少一些基本的知识,但是我很困惑。
您在以下位置缺少name
属性:
<input type="text" id="SetListName" />
Replace 更换
<input type="text" id="SetListName" />
with 同
<input type="text" id="SetListName" name ="SetListName"/>
You need to have a 'name' attribute in the form for each input field that you want to read in PHP. 对于要在PHP中读取的每个输入字段,您都需要在表单中具有“名称”属性。 So you're code should read:
因此,您的代码应为:
<form action="php/setlist.php" method="post">
<input type="text" id="SetListName" name="SetListName"/>
<input type="hidden" id="newList" name="newList" value="" readonly="readonly" style="border: none;">
<input type="submit" style="width:150px;"><br /><br />
use 采用
<input type="text" id="SetListName" name="SetListName" />
you have not used name
attribute 您尚未使用
name
属性
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.