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
https://forums.phpfreaks.com/topic/20219-using-get-in-form-on-mod-rewrite/
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

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.