dongtuo4132 2016-04-12 12:47
浏览 32

通过ajax / drop list计算表单填充的机制

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

I have been looking at this sample for a week now trying to make adjustments to change the output for a GET method to fill the forms with data from the sql drop list. I have been over snippet after snippet trying to work this out.

I have the drop list worked out which lists all the product codes in the sql, but for the life of me i have no idea how to activate the $_GET to pull to the data to the input form.

Am i going about this the right way by going through ajax or should i start looking at ASP? I just need to be pointed in the right direction.

// Option 1
$sql="SELECT * FROM `cctv` ORDER BY `cctv`.`SAPCode` ASC ";
$q=mysql_query($sql);
echo "<select name=\"q_option1\">"; 
echo "<option size =30 ></option>";
while($row = mysql_fetch_array($q)) 
{        
echo "<option value='".$row['SAPCode']."'>".$row['SAPCode']."</option>"; 
}
echo "</select>";
?>

<form id="form1" name="form1" method="post" action="">
  <label for="price">price</label>
  <input type="text" name="price" id="price" />
</form>
  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 我想咨询一下路面纹理三维点云数据处理的一些问题,上传的坐标文件里是怎么对无序点进行编号的,以及xy坐标在处理的时候是进行整体模型分片处理的吗
    • ¥15 CSAPPattacklab
    • ¥15 一直显示正在等待HID—ISP
    • ¥15 Python turtle 画图
    • ¥15 关于大棚监测的pcb板设计
    • ¥15 stm32开发clion时遇到的编译问题
    • ¥15 lna设计 源简并电感型共源放大器
    • ¥15 如何用Labview在myRIO上做LCD显示?(语言-开发语言)
    • ¥15 Vue3地图和异步函数使用
    • ¥15 C++ yoloV5改写遇到的问题