ninedoors Posted July 20, 2009 Share Posted July 20, 2009 I have a form that submits 6 variables to pull data and displays it on the page. I am having a problem though with one variable and can't figure out what is going wrong. The hmtl for the variable I have having trouble with is <?php echo '<form name="filter" action="'.$scripturl.'" method="get"> <table width="100%" border="0" align="center" cellpadding="2" cellspacing="0" style="margin-top:6px;"> <tr> <td style="font-weight:bold; padding:3px 5px 3px 10px; text-align:right">'.$txt['records_season'].':</td> <td align="left"><input type="hidden" name="action" value="leaguerecords"> <span id="select_season" style="padding-left:4px;">'.$context['osm']['record_selects']['season'].'</span> <span id="select_divs" style="padding-left:4px;">'.$context['osm']['record_selects']['divs'].'</span> <span id="select_rp" style="padding-left:4px;">'.$context['osm']['record_selects']['rp'].'</span> </td> </tr> <tr> <td style="font-weight:bold; padding:3px 6px 3px 10px; text-align:right;">'.$txt['records_record'].':</td> <td align="left"> <span id="select_type" style="padding-left:4px;">'.$context['osm']['record_selects']['type'].'</span> <span id="select_sa" style="padding-left:4px;">'.$context['osm']['record_selects']['sa'].'</span> <span id="select_length" style="padding-left:4px;">'.$context['osm']['record_selects']['length'].'</span> </td> </tr> <tr> <td> </td> <td style="padding:7px 0 0 6px; text-align:left;"><input type="submit" value="Get Records"></td> </tr> </table> </form>'; ?> All the $context['osm']['record_selects'] are select boxes. The one I am having problems with is the $context['osm']['record_selects']['divs'] which are the divisions in my league. So when I submit the form I see all the correct variables in the address bar. But on my submit page I have this code to filter the division variable: <?php //divisions if (isset($_REQUEST['div']) && ($_REQUEST['div'] == 0)) { $context['osm']['record_settings']['div'] = 0; echo $_REQUEST['div']; } elseif (isset($_REQUEST['div'])) { //make sure that the divs exists $request = $smcFunc['db_query']('', 'SELECT division FROM {db_prefix}osm_divisions WHERE event_id = {int:event} AND division = ({string:divs})', array( 'event' => $context['osm']['record_settings']['season'], 'divs' => $_REQUEST['div'], )); while ($row = $smcFunc['db_fetch_assoc']($request)) $context['osm']['record_settings']['div'] = $row['division']; $smcFunc['db_free_result']($request); if (!isset($context['osm']['record_settings']['div'])) $context['osm']['record_settings']['div'] = $context['osm']['default_div']; } else $context['osm']['record_settings']['div'] = $context['osm']['default_div']; ?> Obviously the echo in the first condition is only there for debugging. So having the div variable set to 0 means get all divisions. But when I submit this form it is always true in the first condition even though the echo inside the condition says 'A' or 'B'. I can't figure ou how this is possible. Any thoughts or help would be great. Nick Link to comment https://forums.phpfreaks.com/topic/166611-_request-problems/ Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.