Drop Down Field to Drop Down Field

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • fruityfreak
    New Member
    • Jun 2007
    • 24

    Drop Down Field to Drop Down Field

    Hi everyone!

    I was just wondering if it's possible to do the following... And is it hard to implement such function into PHP codes...

    Assume that I have a drop down field whereby a user can select the different brand mobile phone i.e. Nokia, Samsung...

    For instance, when a user selects Nokia, another drop down field will update its values to the available Nokia models stated in the database, for example, 6300, 6500, etc will appear in the other drop down list...

    Thanks for looking at my query...
  • prabhakarb
    New Member
    • Dec 2007
    • 1

    #2
    <td align="center">
    <form method="post" name="addnew_ad dons" class="addons_l ayout">
    <fieldset style="width:40 %;padding:4px;" >
    <legend style="padding: 0px;font-family:verdana; font-weight:bold">Ad ding New Addons for Items: </legend>
    <table width="99%" cellpadding="3" cellspacing="2" border="0">
    <tr>
    <td align="right">S elect Category</td>
    <td align="left">
    <select name="items_cat egory_id" onchange="javas cript:this.form .submit();">
    <option value="">---Select---</option>

    <?php

    $categories = get_categories( $view_restauran t_id );

    if ( ($categories!=f alse)&& is_array($categ ories)) {

    foreach($catego ries as $category_value ){

    $selected = ($items_categor y_id==$category _value['id'])?"selected":"" ;

    echo "<option value='" . $category_value['id'] . "' $selected >" . $category_value['category'] . "</option>";

    }
    }
    ?>
    </select>
    <?php
    if(isset($error _category)){
    echo '<div class="error_me ssage">' . $error_category . '</div>';
    }
    ?>
    </td>
    </tr>
    <tr>
    <td align="right">S elect Items</td>
    <td align="left">
    <select name="item_name[]" multiple>
    <?php

    foreach ($items_categor y as $items_category _value){

    echo "<option value='" . $items_category _value['id'] . "'>" . $items_category _value['item_name'] . "</option>";
    }
    ?> </select>
    </td>
    </tr>
    <tr>
    <td align="right">A ddons</td>
    <td align="left">
    <input type="text" name="addons" value=
    "<?php
    echo (isset($menu_da ta['addons'])) ? $menu_data['addons'] : "";
    ?>">
    </td>
    </tr>
    <tr>
    <td align="right">A ddons Prise</td>
    <td align="left">
    <input type="text" name="addonspri se" value="<?php echo (isset($addonsp rize))?$addonsp rize:""; ?>">
    </td>
    </tr>
    <tr>
    <td align="right">
    <a href="<?php echo buildurl( array('pid'=>6, 'action'=>'vewm enu', 'restaurant_id' =>$view_restaur ant_id) ) ; ?>">
    <img src="templates/images/button_back.gif " border="0">
    </a>
    </td>
    <td align="right" style="padding-right:52px;">
    <input type="image" src="templates/images/button_submit.g if" style="width:60 px; height:23px;" alt="Submit" name="addons">
    </td>
    </tr>
    </table>
    </fieldset>
    </form>
    </td>


    _______________ ______
    by using the javascript it is possible

    Comment

    Working...