Multiple forms

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
hw23
Forum Newbie
Posts: 1
Joined: Thu Dec 11, 2008 9:19 pm

Multiple forms

Post by hw23 »

I have a loop that extracts data out of the database and outputs a dropdown form with each line with options for the user. I have included an onChange = "this.form.submit();" for each dropdown. This works fine in Firefox, but does not work so well in Internet Explorer(yes, scripting is enabled). Here's the code:

Code: Select all

 
$statusMessage = '<form method="post" action="some.php">
<input type = "hidden" name ="variable1" value ="'.$variable1.'"' />
<input type = "hidden" name ="variable2" value ="'.$variable2.'"' />
<select name = "'.$variable1.$variable2" onChange = "this.form.submit();">
<option value = "option_1"> Option 1</option>
<option value = "option_2"> Option 2</option>
<option value = "option_3"> Option 3</option>
<option value = "option_4"> Option 4</option>
</form>';
 
This code is then just echo'd for each line. $variable 1 and $variable2 are unique, so to name each form differently I just give combine the two for a unique name I can call at some.php.

Symptoms: In Mozilla this works great. With IE(both 6 and 7) the variable1 and variable 2 are passed along, however option_1(the 1st default option displayed) is always passed along except for the last one of my list. The last one of the list always passes along the correct the correct value.

So if I had two outputs A and B,and I selected Option2 for each of them...then A would send Option1 but B would send the selected Option2.
User avatar
requinix
Spammer :|
Posts: 6617
Joined: Wed Oct 15, 2008 2:35 am
Location: WA, USA

Re: Multiple forms

Post by requinix »

Is that really the code you use? Because there's a typo. And the <select> wasn't closed.
Make sure your HTML is correct.

And are you saying you're trying to submit more than one form at the same time?
Post Reply