變化method
到GET
id和從該東東刪除行動。它會自動把id放入get中。我也爲你修好了你的標籤。
<?php
$connect = mysql_connect("localhost","root","");
$sel_database = mysql_select_db("test");
$id = (int)$_POST['id'];
?>
<table bordercolor="#0099FF" width="1000" border="5" align="center" cellpadding="5" cellspacing="5">
<tr>
<td><form name="get_id" method="GET" action="Test.php">
<label for="select">ID:</label>
<select name="id" id="select">
<?php
$query = "SELECT * FROM test";
$run = mysql_query($query);
while($output = mysql_fetch_array($run)){
echo "<option value=\"{$output['id']}\">{$output['id']}</option>";}
?>
</select>
<input type="submit" id="button" value="Submit"></form>
</td>
如果必須使用GET和POST試試這個
<?php
$connect = mysql_connect("localhost","root","");
$sel_database = mysql_select_db("test");
$id = (int)$_POST['id'];
?>
<script type="text/javascript">
function changeAction() {
document.get_id.action = 'Test.php?id=' + document.get_id.options[document.get_id.selectedIndex].value;
}
</script>
<table bordercolor="#0099FF" width="1000" border="5" align="center" cellpadding="5" cellspacing="5">
<tr>
<td><form name="get_id" method="POST" action="Test.php">
<label for="select">ID:</label>
<select name="id" id="select" onchange="changeAction">
<?php
$query = "SELECT * FROM test";
$run = mysql_query($query);
while($output = mysql_fetch_array($run)){
echo "<option value=\"{$output['id']}\">{$output['id']}</option>";}
?>
</select>
<input type="submit" id="button" value="Submit"></form>
</td>
來源
2012-03-02 16:29:33
Bot
http://stackoverflow.com/questions/how-to-ask – hakre 2012-03-02 16:28:53