【问题标题】:Running a php function when dropbox on change event and returns a table from the php function在更改事件时运行 php 函数并从 php 函数返回一个表
【发布时间】:2015-11-06 10:23:03
【问题描述】:

我有以下用于保管箱的代码;

 <select name="Symptom" id="Symptomid" onchange="LSC()">

在 Dropbox 中更改时我想运行以下 php 代码;

<?php
$data = array();
{
  $symptoms_name = $_POST['Symptom'];
  $sql1 = mysql_query("SELECT name,description , comments
  FROM symptoms WHERE symptoms.name ='$symptoms_name'") or             

    die(mysql_error());     

    while($row1 = mysql_fetch_assoc($sql1)){
        $data[] = $row1;
    }
}
?>
<?php
if($data){
?>
<table border="1">
    <tr>
        <td>name</td>
        <td>description</td>
        <td>comments</td>
    </tr>

<?php
    if($data){
        foreach($data as $sy){
?>
    <tr>
        <td><?php echo $sy['name']; ?> </td>
        <td><?php echo $sy['description']; ?> </td>
        <td><?php echo $sy['comments']; ?> </td>

    </tr>
<?php
    }
}
?>
<?php
}

?>


</table>
}

and display this table under the dropbox on the original html .

我认为我们必须运行一个 java 脚本,该脚本将调用 php 函数并将表格重新调整为原始 html。

Kindly assist, I know we have to use ajax.

Regards

Azhar

【问题讨论】:

    标签: javascript php html ajax html-select


    【解决方案1】:

    排序,

    看到这个有类似的问题

    http://www.w3schools.com/php/php_ajax_database.asp

    问候

    阿扎尔

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2020-03-19
      • 2023-04-09
      • 1970-01-01
      • 2010-09-28
      • 2019-04-26
      • 2012-03-03
      • 2012-05-19
      • 1970-01-01
      相关资源
      最近更新 更多