Form data not passing to PHP
I have what should be a simple form to pass data to a php page. The fo开发者_Go百科rm 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:
$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. I am a novice with php so I could be missing something basic here, but I am stumped.
You are missing name
attribute in:
<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. 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
精彩评论