Link to home
Start Free TrialLog in
Avatar of rfresh
rfresh

asked on

PHP Form Var Submit Problem

I have two dropdown lists named:

frm_cbo_top
frm_cbo_bottom

I have an OnChange="submit_form();" in each of these dropdown lists - javascript does a form.submit() call.

The problem is that the "post" method .php file *always* catches this line:

if ($frm_cbo_top)
   {
   // take some action
   }

Even when I make a selection in the bottom dropdown the $frm_cbo_top var if statement gets caught because the code flow goes into that section - I want the $frm_cbo_bottom to catch is I select that dropdown and the $frm_cbo_top  to catch if I select that dropdown - what am I missing here?

Thanks...
Avatar of scully00000
scully00000

Rfresh

Likelihood is that when you submit your form, the top combo box is ubmitting a value (default or otherwise). CAn you post the HTML and the PHP up so I can have a look?

Cheers
ASKER CERTIFIED SOLUTION
Avatar of shmert
shmert

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
can you please post complete form (HTML with PHP code )..

?

Lk
Avatar of rfresh

ASKER

I like this solution the best - it seems to be the cleanest and easiest to understand:

<input type="hidden" name="which_menu" value="" />
<select name="frm_cbo_top" onchange="this.form.which_menu='frm_cbo_top'; this.form.submit();">

however, it doesn't work - when I make a selection in the dropdown list (cbo object) I get a javascript error symbol in the lower left corner of my IE 6.0 browser - is there some kind of syntax error?
Ah, I see a bug in my code, use this.form.which_menu.value='frm_cbo_top';
I was missing the 'value' part (I always forget that :-P)