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)来接收数据,然后通过
我认识到, 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).