Help with javascript issue on navigation, need to create unobtrusive dropdown page changer

Hi trying to implement this solution on http://css-tricks.com/unobtrusive-page-changer/   ...but everytime i add the following code inside my header.php in wordpress site:

<?php
      // FACEBOOK CODE SUGGESTION TO FIX NAV WITH NO JAVASCRIPT
      if (isset($_POST['nav-mobi'])) {
             header("Location: $_POST['nav-mobi']");
      }
?>

It seems to break the entire site...but other code update is fine.  See screenshot.  That's just a screenshot for you to reference how to see that the data is coming in properly from the code on the bottom (see code below). that code on top is supposed to be detecting that the "nav-mobi" variable exists and redirecting the page to that URL

<?php
                                           // FACEBOOK CODE SUGGESTION TO FIX NAV WITH NO JAVASCRIPT
                                           //wp_nav_menu(array( 'theme_location' => 'primary-menu', 'items_wrap' => '<select><option>Menu</option>%3$s</select>', 'walker' => new select_menu_walker() ));
                                           wp_nav_menu(array( 'theme_location' => 'primary-menu', 'items_wrap' => '<form action="" method="post"><select name="nav-mobi"><option>Menu</option>%3$s</select><input type="submit" value="Go"></input></form>', 'walker' => new select_menu_walker() ));
                                     ?>


PLease experts help with this, its the code at top of page that is problematic, and wordpress doesnt like something about it but cannot figure out what....
header-info.jpg
Kasonde NeddyDesigner & DeveloperAsked:
Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

x
 
GaryConnect With a Mentor Commented:
Well it seems to be working fine for me.
0
 
GaryCommented:
And if you put that url directly into the browser does it work?

Your code doesn't really make sense - what is the point of the dropdown with just one option?
0
 
Kasonde NeddyDesigner & DeveloperAuthor Commented:
Hi,

This is for the menu on mwebantu.com, to understand better take a look at code behind on website.  Its for smaller screens/devices that we are having the issue on.

Regards,

Kasonde
0
 
Kasonde NeddyDesigner & DeveloperAuthor Commented:
Hi experts, been away, fb partner engineers helped resolved this
0
 
Kasonde NeddyDesigner & DeveloperAuthor Commented:
Mistake, was actually working
0
All Courses

From novice to tech pro — start learning today.