我試圖將結果添加到HTML下拉菜單中。
PHP的作品,如果我把它的HTML表單以外的:它顯示的結果,但我需要它的形式在側面的HTML下拉菜單選擇
<form><form method="post" action="selldo.php">
<label><br /><br /><br /><br />What slot do you want to Sell?</label>
<select name="pokeSLOT" id="pokeSLOT" style="width:150px;padding-left:5px;">
<option value=""></option>
<?php
$result = mysql_query("SELECT * FROM user_pokemon
WHERE belongsto='$_SESSION[username]'");
while($row = mysql_fetch_array($result))
{
echo $row['id'] . " " . $row['pokemon'];
echo "<br />";
}
?>
</select><br/><br/>
<label>Price You Would Like For The Pokemon?</label>
<input type="int" name="cost" id="cost" maxlength="30"/><br/><br/>
<button name="submit" type="submit" id="Submit_But">Sell</button>
<p> </p><p> </p>
</form>
裏面當我看到在下拉菜單中並沒有什麼,但如果它使SQL出形式的它張貼結果的頁面,以便它工作正常,我只需要它在側下拉HTML表單
PS我有連接ontop的頁面
謝謝修復它再次感謝 –
如果你這樣做,你將有問題存儲所選選項的ID。如果您需要這樣做,請參閱我的答案。 – markus
@詹姆斯,XSS安全漏洞呢?我建議用'htmlentities($ row ['pokemon'])''同上'id'(儘管'intval($ row ['id'])''''可以更容易_(提供)來替換'$ row ['pokemon']'它實際上是一個int)_) – Johan