473,382 Members | 1,526 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,382 software developers and data experts.

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...
Dec 20 '07 #1
1 1368
<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

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

Similar topics

46
by: Kingdom | last post by:
In my data base I have a list of componet types e.g. type A - I have 8 off - type B I have 12 off etc. I'm using Set objRS = objDC.Execute("Select DISTINCT Component_Type FROM Parts_Table") ...
2
by: ehm | last post by:
I am working on creating an editable grid (for use in adding, deleting, and editing rows back to an Oracle database). I have a JSP that posts back to a servlet, which in turns posts to a WebLogic...
4
by: Dan | last post by:
Can anyone offer suggestions on how to do this or if it is possible? I have a form that uses a drop down box and 2 text fields. What I am trying to do is have the value of each text box set by...
2
by: kmnotes04 | last post by:
Is it possible to link one drop-down box to another? For example, if a name is chosen from a drop-down list, can another drop-down list then automatically display the person's office as a result of...
3
by: John Walker | last post by:
Hi, On an ASP.NET page I have a drop down list control. When the user pulls down the list and makes a selection, I perform validation, and if the validation fails I want the selected item in...
7
by: callawayglfr | last post by:
I am building a database in access where I have a drop down box that relates to a text box, that part I have working but when someone selects information from the first drop down I need it to limit...
5
by: Mark B | last post by:
I'd like to have a field in a gridview (or standalone on a webpage) that not only drops down each salespersons name but also precedes their name with a blue, red, green or orange dot icon depicting...
8
by: gurmet | last post by:
I have two tables; 1. Called "Courses" that contains two fields "Course ID" and "Course Name". 2. Called "Sessions" that contains a field called "Course ID". Then I have a form with a...
14
by: DanicaDear | last post by:
I have a QTY field and an ITEM field. User inputs a number into the QTY field, then tabs over the the next field and there's a down arrow on the right hand side of the field that you click to choose...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.