menu??

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
superman
Forum Commoner
Posts: 29
Joined: Tue Jul 08, 2003 2:54 am

menu??

Post by superman »

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 ?>"> ??????
Gen-ik
DevNet Resident
Posts: 1059
Joined: Mon Aug 12, 2002 7:08 pm
Location: London. UK.

Post by Gen-ik »

Erm.... yeah 8O


If you are using <select> drop down menus you will need to do something like this....

Code: Select all

<select name="state" size=1>
<option value="NY" <?php if(isset($state)&&$state=='NY')&#123;echo('selected');&#125; ?>>NY</option>
<option value="LA" <?php if(isset($state)&&$state=='LA')&#123;echo('selected');&#125; ?>>NY</option>
</select>

...hope that helps.
?>
superman
Forum Commoner
Posts: 29
Joined: Tue Jul 08, 2003 2:54 am

Post by superman »

thanx a lot, i've solved the problem.

can php run two queries at the same time?
for example, i insert the record to the table B, then delete from the table A.
Drachlen
Forum Contributor
Posts: 153
Joined: Fri Apr 25, 2003 1:16 am

Post by Drachlen »

it sure can! you just do the two queries!

Code: Select all

<?php
MYSQL_QUERY("INSERT INTO `b` (field, field2) VALUES ('$field', '$field2')") or die( "Could not write information. Reason: ". mysql_error() );
MYSQL_QUERY("DELETE FROM `a`") or die(mysql_error());
?>
Post Reply