By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,255 Members | 2,575 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,255 IT Pros & Developers. It's quick & easy.

Drop Down Field to Drop Down Field

P: 24
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...
Dec 20 '07 #1
Share this Question
Share on Google+
1 Reply


P: 1
<td align="center">
<form method="post" name="addnew_addons" class="addons_layout">
<fieldset style="width:40%;padding:4px;">
<legend style="padding:0px;font-family:verdana;font-weight:bold">Adding New Addons for Items: </legend>
<table width="99%" cellpadding="3" cellspacing="2" border="0">
<tr>
<td align="right">Select Category</td>
<td align="left">
<select name="items_category_id" onchange="javascript:this.form.submit();">
<option value="">---Select---</option>

<?php

$categories = get_categories( $view_restaurant_id );

if ( ($categories!=false)&& is_array($categories)) {

foreach($categories as $category_value ){

$selected = ($items_category_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_message">' . $error_category . '</div>';
}
?>
</td>
</tr>
<tr>
<td align="right">Select Items</td>
<td align="left">
<select name="item_name[]" multiple>
<?php

foreach ($items_category as $items_category_value){

echo "<option value='" . $items_category_value['id'] . "'>" . $items_category_value['item_name'] . "</option>";
}
?> </select>
</td>
</tr>
<tr>
<td align="right">Addons</td>
<td align="left">
<input type="text" name="addons" value=
"<?php
echo (isset($menu_data['addons'])) ? $menu_data['addons'] : "";
?>">
</td>
</tr>
<tr>
<td align="right">Addons Prise</td>
<td align="left">
<input type="text" name="addonsprise" value="<?php echo (isset($addonsprize))?$addonsprize:""; ?>">
</td>
</tr>
<tr>
<td align="right">
<a href="<?php echo buildurl( array('pid'=>6, 'action'=>'vewmenu', 'restaurant_id'=>$view_restaurant_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.gif" style="width:60px; height:23px;" alt="Submit" name="addons">
</td>
</tr>
</table>
</fieldset>
</form>
</td>


_____________________
by using the javascript it is possible
Dec 20 '07 #2

Post your reply

Sign in to post your reply or Sign up for a free account.