Solved

Populate and assign a variable to a selection in a drop down (listbox).

Posted on 2004-04-16
2
170 Views
Last Modified: 2008-03-17
Simple question of creating a list of 4 items (apple, orange, grape,  kiwi) and once the user selects which one, set a variable $fruit to it.  Please help by a coding example.
Thank you,

Russ
0
Comment
Question by:RUSS_EMI
2 Comments
 
LVL 12

Accepted Solution

by:
venkateshwarr earned 50 total points
ID: 10847171
Something like this?

<?php
if(isset($_REQUEST['fruits']))
{
      $fruit = $_REQUEST['fruits'];
      print "fruit = $fruit";
}



?>

<form name='fruitselection' method='get'>
<select name='fruits' onchange="document.forms['fruitselection'].submit();">
<option value='apple'> apple
<option value='orange'> orange
<option value='grape'> grape
<option value='kiwi'> kiwi
</select>
<input type="submit">
</form>
0
 

Author Comment

by:RUSS_EMI
ID: 10861384
Something exactly like that.  Please let me try it out in a few days (I'm traveling now) and I'll be glad to award the points if it is works as I think it will.
Thank you,
Russ
0

Featured Post

Does Powershell have you tied up in knots?

Managing Active Directory does not always have to be complicated.  If you are spending more time trying instead of doing, then it's time to look at something else. For nearly 20 years, AD admins around the world have used one tool for day-to-day AD management: Hyena. Discover why

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
mysql update statement 3 23
Loop through multiple arrays 13 29
How can I make this form submit to itself? 10 28
Get a subdirectory name from a url 5 16
Password hashing is better than message digests or encryption, and you should be using it instead of message digests or encryption.  Find out why and how in this article, which supplements the original article on PHP Client Registration, Login, Logo…
3 proven steps to speed up Magento powered sites. The article focus is on optimizing time to first byte (TTFB), full page caching and configuring server for optimal performance.
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.

831 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question