English 中文(简体)
采用<电子>元素和购买力平价
原标题:Populating a form using <select> element and PHP

I m developing an addressing management system for our CMS that I ve created, and I need to be able to take addresses stored in a SQL database and populate a form with the data when pulled from the database, but only after being selected with a SELECT element.

然而,我能够阅读使用PHP/WySQL的数据,但我相对倾向于如何使用 Java(或Ajax)来接收数据,然后通过S/9/T,然后按表格将其移至各自的投入领域。

我认识到, Java稿要求用<代码>onChange 或onSelect在<代码>SlectT要素(forgive my recal Understanding of Javascript/Ajax)上打手。

法典类似:

<form action="action.php?step=2" method="post" name="frmAddress">
<ul>
  <li><label for"presetAddress">Use a saved address</label>
    <select class="input" id="presetAddress">
      <option value="none" selected="selected">Select...</option>
<?php
  $sql = "SELECT * FROM table WHERE foo= $bar ;
  $res = mysql_query($sql);
  while($row = mysql_fetch_assoc($res)) {
    if($row) {
      extract($row);
?>
      <option id="presetAddress" value="<?php echo $id; ?>"><?php echo $address . " " . $city . ", " . $state . $x; ?></option>
<?php
    }
  }
?>
</select>
</form>

At this point, I have no idea where to start, but I m not inclined to have someone just write it out entirely. I m looking more to be pointed in the right direction, so I m not having to keep coming back for things like this (I d rather learn it now and be able to figure it out in the future).

问题回答

如果你对这一点持相对新意的话,就建议使用 j。 j 食堂是学习 j语的方便之举,对美国宇宙航空研究开发机构来说,有许多冰 short。

http://jquery.com/"rel=“nofollow>j 高质量的网站将是一个很大的开端,许多有用的范例





相关问题
selected text in iframe

How to get a selected text inside a iframe. I my page i m having a iframe which is editable true. So how can i get the selected text in that iframe.

How to fire event handlers on the link using javascript

I would like to click a link in my page using javascript. I would like to Fire event handlers on the link without navigating. How can this be done? This has to work both in firefox and Internet ...

How to Add script codes before the </body> tag ASP.NET

Heres the problem, In Masterpage, the google analytics code were pasted before the end of body tag. In ASPX page, I need to generate a script (google addItem tracker) using codebehind ClientScript ...

Clipboard access using Javascript - sans Flash?

Is there a reliable way to access the client machine s clipboard using Javascript? I continue to run into permissions issues when attempting to do this. How does Google Docs do this? Do they use ...

javascript debugging question

I have a large javascript which I didn t write but I need to use it and I m slowely going trough it trying to figure out what does it do and how, I m using alert to print out what it does but now I ...

Parsing date like twitter

I ve made a little forum and I want parse the date on newest posts like twitter, you know "posted 40 minutes ago ","posted 1 hour ago"... What s the best way ? Thanx.

热门标签