Solved

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

Posted on 2004-04-16
2
172 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
JQuery Search Filter 2 71
php error 27 58
Google Dork query 7 66
Why can I INSERT a DATETIME record into mysql but I can't UPDATE it? 15 39
Deprecated and Headed for the Dustbin By now, you have probably heard that some PHP features, while convenient, can also cause PHP security problems.  This article discusses one of those, called register_globals.  It is a thing you do not want.  …
This article discusses how to create an extensible mechanism for linked drop downs.
The viewer will learn how to count occurrences of each item in an array.
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…

726 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