Board index   FAQ   Search  
Register  Login
Board index PHP PHP General

menu??

General discussions related to php

Moderators: macek, egami, gesf

menu??

Postby superman » Sun Jul 13, 2003 7:15 am

the problem is the menu can't display the value when I click the edit button from the previous form.

I know the the text field is <value="<? echo $name ?>"> but how about the menu? <select name="State" value="<? echo $state ?>"> ??????
superman
New php-forum User
New php-forum User
 
Posts: 36
Joined: Fri Jun 27, 2003 11:54 pm

Postby Oromian » Sun Jul 13, 2003 8:34 pm

...more details...
Oromian
New php-forum User
New php-forum User
 
Posts: 38
Joined: Fri Apr 04, 2003 2:44 pm
Location: Canada

Postby bezmond » Sun Jul 13, 2003 11:48 pm

the syntax for your Select box is incorrect...
<select name="state">
<option><? echo $state ?></option>
</select>

Andrew
User avatar
bezmond
Moderator
Moderator
 
Posts: 312
Joined: Sat Apr 05, 2003 4:33 am
Location: Mansfield, UK

Postby WiZARD » Mon Jul 14, 2003 1:26 am

User avatar
WiZARD
Moderator
Moderator
 
Posts: 1257
Joined: Thu Jun 20, 2002 10:14 pm
Location: Ukraine, Crimea, Simferopol

Postby pootergeist » Mon Jul 14, 2003 2:50 am

in an option tag the parameter selected="selected" preselects that choice so, assuming $state holds the wanted state

Code: Select all
$states_array = array('a','b','c');
while(.......$cnt++.....)
{
echo '<option value="' .$states_array[$cnt]. "';
echo ($state == $states_array[$cnt]) ? ' selected="selected"' : '';
echo '>' .$states_array[$cnt]. '</option>
';
}


to give a basic idea.
pootergeist
New php-forum User
New php-forum User
 
Posts: 191
Joined: Wed Jan 29, 2003 7:11 am
Location: UK


Return to PHP General

Who is online

Users browsing this forum: No registered users and 4 guests

Sponsored by Sitebuilder Web hosting and Traduzioni Italiano Rumeno and antispam for cPanel.