apple
Apr 25 2007, 11:35 PM
suppose i make a dropdown menu having value 1, 2, 3, 4, 5, one option can be selected, and selected option is stored in database. now i create an edit page, how do i display the selected value in the menu and other values in dropdown, for example, Menu is like Select One 1 2 3 4 5 and i select 3, this 3 is stored in database, now on the edit page i want to show 3 as already selected, something like that.. QUOTE <select name="select_thing"> <option value="1">1</option> <option value="2">2</option> <option value="3" selected>3</option> <option value="4">4</option> <option value="5">5</option> </select> I will be very thankful, if someone could help by explaining how do i make option 3 as selected.. eg. how i know option 3 is selected and stored in db.
Reply
Saint_Michael
Apr 26 2007, 12:54 AM
Here are some links to help you out. This is a wizard that designs a php drop down menu http://www.thesitewizard.com/wizards/navigationmenu.shtmlThis is a script that creates a dhtml drop down menu http://www.scriptdungeon.com/script.php?ScriptID=1010This site talks about what goes into a php drop down menu and provides files as well http://www.phpclasses.org/browse/package/1562.htmlHopefully that helps give you an idea on what to look for in designing a php drop down menu GOOGLE KEYWORDS "drop down menu in php"
Reply
galexcd
May 12 2007, 07:02 PM
Couldn't you just make an if statement? If you know how to get and set the values in the database already, all you'd have to do is somthing like: CODE <select name="select_thing"> <option value="1"<?php if(mysql_result($result,"","value")==1) echo" selected"; ?>>1</option> <option value="2"<?php if(mysql_result($result,"","value")==2) echo" selected"; ?>>2</option> <option value="3"<?php if(mysql_result($result,"","value")==3) echo" selected"; ?>>3</option> <option value="4"<?php if(mysql_result($result,"","value")==4) echo" selected"; ?>>4</option> <option value="5"<?php if(mysql_result($result,"","value")==5) echo" selected"; ?>>5</option> </select> If that's what you meant, here's a more code-conserving way of writing it: CODE <?php ${mysql_result($result,"","value)}=" selected";?> <select name="select_thing"> <option value="1"<? echo $1 ?>>1</option> <option value="2"<? echo $2 ?>>2</option> <option value="3"<? echo $3 ?>>3</option> <option value="4"<? echo $4 ?>>4</option> <option value="5"<? echo $5 ?>>5</option> </select>
Reply
hitmanblood
May 18 2007, 08:00 PM
OK this solution will work also I encourage you to try it it looks more simple to me then others. I cannot tell is it because I use it and I am familiar with it or just because it is simpler then other. Good luck with whatever you are doing For the script I think that it doesn't need any more explanation also I would like to point out that I took in count that when you have loaded this value from your database that then you have saved it in the initial_var that is initial variable. CODE <select name="testlist"> <option <? if(initial_var == "1"){ echo 'selected'; } >? >1</option> <option <? else if(initial_var == "2"){ echo 'selected'; } >? >2</option> <option <? else if(initial_var == "3"){ echo 'selected'; } >? >3</option> <option <? else if(initial_var == "4"){ echo 'selected'; } >? >4</option> <option <? else{ echo 'selected'; } >? >5</option> </select>
Reply
Similar Topics
Keywords : editing menu php- Can I Make Dynamic Menu In Php
- is it posible to make dynamic menu in php without javascript (7)
As there are many java script by which we can have event based interaction like,message on mouse
over etc,that we can create dynamic menu in javascripts to make navigation bar ,but is it possible
in php to have this acomplished without javascripts,i am new to php,is it possible?. Thanks...
Php And Flash Image Gallery
- Need some help in creating or editing an xml file while viewing some o (5)
Editing Information In A Mysql Database And Deleting Rows
- (5)
I need help with a couple of things. First, I need to know how to retrieve information from a mysql
database and edit it then re add it to the database. I also would like to know how to easily delete
a mysql row. And I want this done without going to phpMyAdmin. Thanks for the help!...
Pulldown Menu
- get a realiable php pulldown menu script (8)
does anyone know where i can get a really good, reliable pulldown php script. one that is cross
browser compatible. you know the drill, mac - pc, bla bla bla. I'm starting a site right now
would like to start it off right. round ...
I Need A Php Editor
- I need that for image editing (1)
I need a php editor whichc can be used for the image editing like FrontPage for HTML. Can any body
give a link for that...
Editing Footer.php
- adding a script (2)
hey can somebody put this script into my footer.php file? because i don't know how. the script
has to go between the and ok this is the script... CODE <!-- Clicksor.com Advertising
Code Begin --> <script type='text/javascript'> <!--
clicksor_layer_border_color = '#B4D0DC'; clicksor_layer_ad_bg = '#ECF8FF';
clicksor_layer_ad_link_color = '#0000CC'; clicksor_layer_ad_text_color = '#000000';
clicksor_text_link_bg = ''; clicksor_text_link_color = '#000FFF';
clicksor_enable_pop = fa...
Using The Image Editing Functions Of Php
- Specifically, lines or regular polygons. (4)
I've been experimenting a little with PHP's image functions and I was trying to see if I
could make something that looked 3D, so I started with a cube because it's simple. To make an
isometric picture of a cube, you need to start with a regular hexagon. However, making a regular
hexagon isn't the easiest thing. Is there a function to create a regular polygon, or specify an
angle and magnitude for a vector?...
Mysql Edit
- editing info in a MYSQL database (4)
I have a simple database with a php form thats inserts the info into the database, and another file
that extracts the info to display the info on another page.... Now my question is ......how do i
add the EDIT button to edit the database??? here is my database CODE CREATE TABLE `businesses`
( `id` int(10) NOT NULL auto_increment, `business` varchar(255) NOT NULL
default '', `description` text NOT NULL, `emailaddress` varchar(255) NOT NULL
default '', `website` varchar(255) NOT NULL default '', ...
Html Font Tags In Php
- editing fonts using html? (11)
I have a php script thats is fully written in php (no html at all). Now for my question, how can i
edit the fonts? Ill make it easier to understand, the following is a data script (found the
script): CODE <? $mese[0]="-"; $mese[1]="January";
$mese[2]="February"; $mese[3]="March";
$mese[4]="April"; $mese[5]="May";
$mese[6]="June"; $mese[7]="July";
$mese[8]="August"; $mese...
Image/scrolling Menu Correlation
- Help.... plz... (0)
Hey Guyz... I'm working on re-designing my website, and I need a way to set-up my affiliates
page. I have several (decent looking, not that it matters) images for my possible affiliates to
choose from. I currently have this code in effect... CODE <html> <p
align=center>Two different sized advertisments are currently available for ad-exchanges.
Purchasing advertising is currently unavailable. Here are your ad-choices.<select multiple
name="images" size=5><option>88x31 pixel box<option>120x240 pixel
tower</select...
Invision Power Board help
- Editing Redirections.. (2)
I put the login for the forums on the index of my site. (mysite.com/index.php) I want to be able to
log on there, then have it go to another page of my site (mysite.com/members/index.php), and link
the forums from that page, rather than it redirecting me straight to the forums. Anyone have an idea
on how to accompolish this?...
Looking for editing, drop, menu, php
|
|
Searching Video's for editing, drop, menu, php
|
advertisement
|
|