469,282 Members | 1,704 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,282 developers. It's quick & easy.

Passing all <option> from <select> to php

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
1 2173
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.

Similar topics

2 posts views Thread by LC's No-Spam Newsreading account | last post: by
2 posts views Thread by Craig Keightley | last post: by
3 posts views Thread by Iain Hallam | last post: by
9 posts views Thread by eihabisaac | last post: by
1 post views Thread by CARIGAR | last post: by
reply views Thread by suresh191 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.