Jump to content

Using GET in Form on Mod Rewrite


onlyican

Recommended Posts

Hey guys
Heres a good question
I have a page which looks like this in real
friends.php?l=All&p=1

I made it look nice with Mod ReWrite
So now
friends/All/1

Now
The All us a search fuction
They can choose to look at all profiles
Or just Disabled People
Or Just Parents
ect

if I create the form
<form method='get' action=''>
<select name='l'>
<option>All</option>
<option value='Disabled_People'>Disabled People</option>
</select>
If I select Disabled People for example, then it will mess up, it will show like so

friends/All/1?l=Disabled_People

The page linking works ok, as its links

Anyone have any suggestions on how I can do this?
Link to comment
Share on other sites

You could throw a little javascript in your form:

This may not work for you out of the box, but I'm sure you could tweak it!  :)

[code]
<form method='get' id="search_form" action=''>
<input type="hidden" id="my_i" name="which" value="<?= $_REQUEST['p'] ?>" />
<!-- put a script tag here!!!  (script) -->
function search()
{
  i          = document.getElementById('my_i').value;
  sel        = document.getElementById('select_srch');
  form        = document.getElementById('search_form");
  form.action = "friends/" + sel.options[sel.selectedIndex].value + "/" + i;
  form.submit();
}
</script>
<select name='l' id="select_srch" onChange="javascript: search();">
<option>All</option>
<option value='Disabled_People'>Disabled People</option>
</select>
</form>
[/code]

Jeff
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.