开发者

Auto fill form after selecting an item from my combo box

I am stuck on customerdetails.php page where customer need to select the billing address title from the combo box & the automatically the form with firstname,lastname,address,city...etc fields should get filled with the details from the customer table in database. How should i achieve that?

      <tr>
            <td colspan="2">
                <select name="address"><
                    &l开发者_运维问答t;option value="#">Select Address...</option>
                        <?php
                            $address = getAddressTitle($customer_id);
                            $count = count($address);
                                for ($i = 0; $i < $count; $i++) 
                                {
                                    extract($address[$i]);
                                    echo '<option value="'. $addressid .'">' . $addresstitle . '</option>';
                                }
                                ?>
                </select>
            </td>
        </tr>

The above code is used for combo box values.


IT seems that you should send ajax request after selecting billing address to server, select data from db and return result in json, fill form with your fetched data. For ajax it's quick and simple to use library like jquery.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜