表单数据未传递到PHP

表单数据未传递到PHP,php,forms,Php,Forms,我有一个简单的表单将数据传递到php页面。表格为: <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="sub

我有一个简单的表单将数据传递到php页面。表格为:

<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 />

我从表单中获得了新列表,但SetListName没有通过。我是一名php新手,因此我可能在这里缺少一些基本的东西,但我被难住了。

您在以下内容中缺少了
name
属性:

<input type="text" id="SetListName" />

更换

<input type="text" id="SetListName" />


对于要在PHP中读取的每个输入字段,表单中需要有一个“name”属性。因此,您的代码应该是:

<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 />



使用


您没有使用
名称
属性

<input type="text" id="SetListName" name ="SetListName"/>
<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 />
<input type="text" id="SetListName" name="SetListName" />