Forum Moderators: coopster

Message Too Old, No Replies

more than one select form on the same page.

         

2fargon

12:15 am on May 3, 2004 (gmt 0)



How can I create a page with more than one select form on the same page, and pass the parameters using POST to another php page?

This is different from using the MULTIPLE attribute, where more than one value can be chosen in the same select form.

foreach ($users as $user) {
++$j;
$user_data = get_userdata($user->ID);
$userarray[$j] = $user_data->user_nickname;
}
?><select id="userselect[]" name="userselect[]">
<option value="#NONE#">- Select -</option>
<?php foreach($userarray as $wpuser) {
echo '<option value="$wpuser">'.$wpuser.'</option>';
}?>
</select>
<?php }

This function gets called about ten times on the same page, once for each "old username". What I want to do is, provide a list of "wpuser" usernames to choose from for each of the "old usernames"

The code above does not seem to work.
I will greatly appreciate any help.

Thank you.

httpwebwitch

5:59 am on May 4, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Instead of an empty array numerator, put a key value in the select names.

foreach ($userarray as $wpkey){
print("<select name='userselect[".$wpkey."]'>");
foreach ($userarray as $wpval){
print("<option value='".$wpuser."'>".$wpuser."</option>")
}
print("</select>")
}

See what that does - put it in your form, submit it, then print the results:

print_r($HTTP_POST_VARS['userselect']);