我有 index.php 和 index2.php
这是 index.php:
当我提交此值时,index2.php 将显示。这是 index2.php:
我不明白,为什么会显示此错误消息。
无论如何,提交这些选定的值(index2.php)它会从数据库中说出一个疾病名称。单击提交,此文本显示(下):
我在这里讨厌我的代码:
索引.php
<?php
$con = mysql_connect("localhost","root","");
mysql_select_db("symptomchecker",$con) or die(mysql_error());
$q = "select dtid,diseasetype from disease_type";
$result = mysql_query($q,$con) or die(mysql_error());
$numRB = mysql_num_rows($result);
echo "<html><head><title>Disease Type</title></head><body><h1>Disease List</h1></br><form action='index2.php' method='post'>";
$i=0;
while($row = mysql_fetch_array($result)){
echo $row['diseasetype'];
echo "<input type='radio' name='diseasetype' id='pet1' value='$row[dtid]' />" ;
echo "<br />";
$i++;
}
echo " <input type='submit' value='submit' name='submit'></form></body></html>";
?>
index2.php:
$diseasetypeid = "$_POST[diseasetype]"; $j=0;$i=0; $query = "select did from disty_dis_rel where dtid = ".$diseasetypeid.""; $result1 = mysql_query($query,$con) or die(mysql_error()); echo "<html><head><title>symptom</title></head><body><h1>symptom List</h1></br><form action='' method='post'>"; while($row = mysql_fetch_array($result1)) { $z=$row['did']; $query2 = "select sid,symptomname from symptom where sid = ".$z.""; $result2 = mysql_query($query2,$con) or die(mysql_error()); while($row2 = mysql_fetch_array($result2)) { echo $row2['symptomname']; echo "<input type='checkbox' name='pets[$i]' id='pet1' value='$row[sid]' />" ; echo "<br />"; $i++; } $j++; } echo " <input type='submit' value='submit' name='submit'></form></body></html>"; if(isset($_REQUEST[submit])) { **foreach ($_REQUEST[pets] as $key=>$values)** { $yy.=$values."-"; } $yy=rtrim($yy,"-"); $xx = "select did,sids from dis_sym_rel where sids=".$yy.""; $result3 = mysql_query($xx,$con) or die(mysql_error()); while($row = mysql_fetch_array($result3)){ $p=$row[did]; $xxx = "select did,diseasename from disease where did=".$p.""; $result4 = mysql_query($xxx,$con) or die(mysql_error()); while($row4 = mysql_fetch_array($result4)) { echo $row4[diseasename]; } } } ?>
###doublestar### 之间的线是错误线(49)。