Help with Drop Down selection in PHP Code

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
bob1660
Forum Newbie
Posts: 1
Joined: Fri Jun 05, 2009 10:34 am

Help with Drop Down selection in PHP Code

Post by bob1660 »

Goodday All,

I am very new with PHP and MySQL. I am busy developing a application, and would like to know how to add a drop down selection in a input field.

EG. Code -

Code: Select all

<td class="hr"><?php echo htmlspecialchars("Hotel")."&nbsp;" ?></td>
<td class="dr"><input type="text" name="Hotel" maxlength="1" value="<?php echo str_replace('"', '"', trim($row["Hotel"])) ?>"></td>
Drop Down should only contain "Westin Grand", "Cullinen" and "Holliday Inn"

Any Help will be greatly appreciated.

Newby PHP coder :crazy:
Last edited by Benjamin on Fri Jun 05, 2009 11:17 am, edited 1 time in total.
Reason: Added [code=php] tags.
User avatar
mikemike
Forum Contributor
Posts: 355
Joined: Sun May 24, 2009 5:37 pm
Location: Chester, UK

Re: Help with Drop Down selection in PHP Code

Post by mikemike »

This is not PHP code, it is basic HTML.

The format for a drop-down is:

Code: Select all

<select name="hotels">
  <option value="hilton">The Hilton</option>
  <option value="ritz">The Ritz</option>
  <option value="queens">Queens</option>
</select>
Loads more detail on w3schools website: http://www.w3schools.com/TAGS/tag_Select.asp
Post Reply