<form action="applications.php" enctype="multipart/form-data" method="post">
Value1: <input type="text" name="value"><br>
Value2: <input type="text" name="value1"><br>
<input type="submit" onmouseover="this.style.cursor=\'pointer\';"OnMouseOut="this.style.cursor=\'default\';">
</form>
<?php
if (isset($_GET['value=20'&&'value1=40']))
{
$username = 'root';
$password = '';
$hostname = 'localhost';
$dataname = mysql_connect($hostname,$username,$password) or die("Connection failed: ");
$selected = mysql_select_db('testdb',$dataname) or die("Could not select table1");
$result = mysql_query("SELECT * FROM `table1`");
$last = '';
echo "<table>
<tr>
<th>id</th>
<th>name</th>
</tr>";
while($row = mysql_fetch_array($result))
{
echo"<tr>
<td>".$row['0']."</th>
<td>".$row['1']."</td>
</tr>";
}
mysql_close($dataname);
}
?>
例如,如果我输入了value1 = 20和value2 = 40,那么我必须得到&#34; table1&#39;结果。任何人都可以帮我纠正这段代码或者告诉我另一种方法。
答案 0 :(得分:1)
你对价值观的警惕是错误的...... if(isset($ _ GET ['value = 20'&amp;&amp;'value1 = 40']))
应该是
if((isset($ _ GET ['value'])&amp;&amp;($ _GET ['value'] =='20')&amp;&amp; (isset($ _ GET ['value2'])&amp;&amp;($ _GET ['value2'] =='40'))