0

我想做下一件事,但我不知道该怎么做,我会尽力解释我

我有一个由这样的 php 代码生成的字段(Works)

<select id="profiles_select" name="profiles_select">                    
  <?php
  do {
  ?>
<option value="<?php echo strtoupper($system['profile']);?>">
<?php echo strtoupper($system['profile']);?></option>
<?php
} while($system = mysql_fetch_assoc($r)); //the "$r" it's the query
  $rows = mysql_num_rows($r);
  if($rows > 0) {
       mysql_data_seek($r, 0);
       $systemas = mysql_fetch_assoc($r); 
  }
?>
</select>

查询

<?php
$q="SELECT DISTINCT profile FROM sys_profiles";
$r=mysql_query($q,$ConecLocal) or die(mysql_error());;
$systemas=mysql_fetch_assoc($r);
$tsys=mysql_num_rows($r);
?>

我需要的?

我需要生成另一个类似于 first 由 php 代码生成的内容,但是这次我需要进行一个查询,包括 first 的值,如下所示:

<?php
$value_select=$_GET['profiles_select'];
$q2="SELECT DISTINCT systems FROM sys_profiles where profile=$value_select";
$r2=mysql_query($q,$ConecLocal) or die(mysql_error());;
$profiles2=mysql_fetch_assoc($r);
$tsys=mysql_num_rows($r);
?>

下一个查询我需要在另一个查询结果中显示,类似于第一个选择(由 php 生成),但在第一个被选中时执行查询

<select id="systems_select" name="system_select">                   
  <?php
  do {
  ?>
<option value="<?php echo strtoupper($system['systems']);?>">
<?php echo strtoupper($profiles2['systems']);?></option>
<?php
} while($profiles2 = mysql_fetch_assoc($r2)); //the "$r2" it's the another query
  $rows2 = mysql_num_rows($r2);
  if($rows2 > 0) {
       mysql_data_seek($r2, 0);
       $systemas = mysql_fetch_assoc($r2); 
  }
?>
</select>

谢谢您的帮助。

4

0 回答 0