By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
437,569 Members | 1,181 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 437,569 IT Pros & Developers. It's quick & easy.

Passing all <option> from <select> to php

P: n/a
Hey,

I wondering if it's possible to retrieve all the <option>-fields from a
<select> when posting a <form> to a php file

Example:
I've got a form like this:

<form action = phpfile.php method=post >
<select name= "name">
<option value="1">1</option>
<option value="2">2</option>
</select>
</form>

and a php file where i retrieve the posted date:

$name=$_POST["name"];

but how can i get the value of option 1 and option 2 no matter if they are
selected or not?

Anybody knows?
Jul 20 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
Lee
Ang Talunin said:

Hey,

I wondering if it's possible to retrieve all the <option>-fields from a
<select> when posting a <form> to a php file


It might help to know why your PHP script cares about the
options that haven't been selected.

If the options aren't likely to ever change, hard code them
into your PHP script. If they are generated dynamically,
you could also create a hidden form field that lists all of
the options.

Jul 20 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.