472,131 Members | 1,400 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,131 software developers and data experts.

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 2258
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
reply views Thread by leo001 | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.