Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

I would like to create a form with

Status
Not open for further replies.

jordanpope

Programmer
Sep 23, 2003
21
BR
I would like to create a form with a number of SELECT elements and an entry button and I want to pass the results to another php form.

If certain items were chosen, that I want to query the user for one further selection.

Anybody have any ideas or know of any good online tutorials for dynamic forms?

Thanks.
 
in your html, you have to do teh following:

1. specify method for your form either get or post

2. assign names to your select boxes and assign values to options of those select boxes

3. when the form is submitted, values of chosen select options will be passed to the php script specified as your form's action

4. in your php script, you have to retrieve teh values passed.
if you used get as your form method, use
Code:
$_GET['blah']
where 'blah' is a name of your select box.
this piece of code will give you the value of the option that was chosen for it. proceed depending on what these values are.

HTH

--------------------------------------------------
Goals are dreams with deadlines
-------------------------------------
 
and if you used post as your form's method, then just say
Code:
$_POST['blah'][/code[
and proceed the same way

--------------------------------------------------
Goals are dreams with deadlines
-------------------------------------
[URL unfurl="true"]http://www.nimlok.com[/URL]
[URL unfurl="true"]http://www.orbusinc.com[/URL]
 
I guess I should have been more specific ...

The form is used as an entry page for an application that produces dynamic reports of different statistics. The user must choose a month, year, and report. Some (not all) of the reports produce lists of items (for example, one returns a list of the top IP addresses that have visisited the site during the month and year that was selected). For only the reports that return lists, I want to further query the user for the number of items to return in the list (for example, number of IP addresses to return). For all other reports that do not return lists I DO NOT want to further query the user.

Therefore, I want to pass the results of the form to the same php page, regardless of what report is selected. But if the reports that return lists are selected, then I further want to query the user and pass this additional variable to the same php page.

Hope this is more clear ...
 
What I would do is write a script that produces HTML forms that submit back to that same script.

If the script is run without inputs, it will produce the 3-select form.

If the script is run with inputs, and the report is must run will require the 4th select input, and it does not have that 4th select input, it will produce an 4-select form with the appropriate items of the first three pre-selected.

If the script is run with inputs and the report selected by the user can be run with the inputs given, the script runs the report.

Want the best answers? Ask the best questions: TANSTAAFL!!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top