Solved

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

Posted on 2004-04-16
2
166 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

Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
Adding Extra Information box 4 26
PHP connection to remote AWS MySQL RDS 4 41
sql sentence 2 13
Insert data into database 2 15
Author Note: Since this E-E article was originally written, years ago, formal testing has come into common use in the world of PHP.  PHPUnit (http://en.wikipedia.org/wiki/PHPUnit) and similar technologies have enjoyed wide adoption, making it possib…
Nothing in an HTTP request can be trusted, including HTTP headers and form data.  A form token is a tool that can be used to guard against request forgeries (CSRF).  This article shows an improved approach to form tokens, making it more difficult to…
The viewer will learn how to dynamically set the form action using jQuery.
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…

762 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

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now