[英]Form data not passing to PHP
我有什么應該是將數據傳遞到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 />
和PHP是:
$SetListSave = $_REQUEST['newList'];
$SetListName= $_REQUEST['SetListName'];
echo $SetListName;
echo $SetListSave;
我從窗體中獲取newList很好,但是沒有傳遞SetListName。 我是php的新手,所以我在這里可能會缺少一些基本的知識,但是我很困惑。
您在以下位置缺少name
屬性:
<input type="text" id="SetListName" />
更換
<input type="text" id="SetListName" />
同
<input type="text" id="SetListName" name ="SetListName"/>
對於要在PHP中讀取的每個輸入字段,您都需要在表單中具有“名稱”屬性。 因此,您的代碼應為:
<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" />
您尚未使用name
屬性
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.