Jump to content


Photo

Using GET in Form on Mod Rewrite


  • Please log in to reply
3 replies to this topic

#1 onlyican

onlyican
  • Members
  • PipPipPip
  • Advanced Member
  • 921 posts
  • LocationHants - UK

Posted 09 September 2006 - 12:45 PM

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?
Tell me the problem, I will try tell you the solution

#2 onlyican

onlyican
  • Members
  • PipPipPip
  • Advanced Member
  • 921 posts
  • LocationHants - UK

Posted 09 September 2006 - 05:36 PM

Anyone???
Tell me the problem, I will try tell you the solution

#3 jefkin

jefkin
  • Members
  • PipPipPip
  • Advanced Member
  • 55 posts

Posted 09 September 2006 - 07:07 PM

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!  :)

<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>

Jeff

#4 onlyican

onlyican
  • Members
  • PipPipPip
  • Advanced Member
  • 921 posts
  • LocationHants - UK

Posted 09 September 2006 - 07:15 PM

Excellent
I just changed the method to post
as it put other crap in there
but it works a dream

Many many many thanx
Tell me the problem, I will try tell you the solution




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users