469,314 Members | 2,182 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,314 developers. It's quick & easy.

Mod Rewrite with POST

133 100+
Hi,

I have to list menus with date in both, what i want to do is when the user select data from them both and hits search i want it to come back with a url like this:

www.website.com/post[list1]/post[list2]/

How would i do this?

Cheers,
Adam
Mar 18 '08 #1
9 1637
adamjblakey
133 100+
Right i have worked out it would need a javascript solution but don't know exactly how this is done please see below:

I assume it would be something like this:

Expand|Select|Wrap|Line Numbers
  1. <select name="service" id="service" onchange="changethis(name)>
  2. <option value="Test" selected="Test">Test</option>
  3.  
  4. <select name="service2" id="service2" onchange="changethis(name)>
  5. <option value="Test" selected="Test">Test</option>
  6.  
  7. <a href="http://www.website.com/updatevaluehere/updatesecondvaluehere/"><img src="image.jpg"></a>
  8.  
Cheers,
Adam
Mar 18 '08 #2
ronverdonk
4,258 Expert 4TB
But for a JavaScript solution this is the wrong forum. I will move this threwad to the DHTML/JavaScript/Ajax forum.

MODERATOR
Mar 18 '08 #3
acoder
16,027 Expert Mod 8TB
Right i have worked out it would need a javascript solution but don't know exactly how this is done
No need for the onchange - just call a function onclick (of the link) which adds these to the href:
Expand|Select|Wrap|Line Numbers
  1. location.href = "http://www.website.com/" + document.getElementById("service1").value + "/" + document.getElementById("service2").value + "/";
  2.  
Mar 19 '08 #4
adamjblakey
133 100+
No need for the onchange - just call a function onclick (of the link) which adds these to the href:
Expand|Select|Wrap|Line Numbers
  1. location.href = "http://www.website.com/" + document.getElementById("service1").value + "/" + document.getElementById("service2").value + "/";
  2.  
Thank you very much for your reply.

Is this right as i tried it here and it does not seem to work.

Expand|Select|Wrap|Line Numbers
  1. <input type="submit" name="Submit" value="Find" onclick="location.href="http://www.web.co.uk/" + document.getElementById("service").value + "/" + document.getElementById("location").value + "/";"/>
Mar 21 '08 #5
acoder
16,027 Expert Mod 8TB
You forgot to escape the quotes within quotes. Either use a single quote for the onclick encapsulating quotes or escape the double quotes using the backslash character.
Mar 21 '08 #6
adamjblakey
133 100+
Thanks this works fine now,

What i need to do, and i don't know if this is possible but i need when a selection is made i need that selection if contains spaces for the spaces to be removed and replaced with - also i need the address to be changed to all lowercase.

Can this be done, if so how?
Mar 22 '08 #7
acoder
16,027 Expert Mod 8TB
Thanks this works fine now,

What i need to do, and i don't know if this is possible but i need when a selection is made i need that selection if contains spaces for the spaces to be removed and replaced with - also i need the address to be changed to all lowercase.

Can this be done, if so how?
The easy solution is to modify the value manually (if possible). That way there's no need to make any modifications afterwards, i.e. make sure that all spaces have been removed and the letters are lowercase.

You can also use the replace method to remove spaces, e.g. val.replace(/\s+/g,"-") and the toLowerCase() method to convert a string into lowercase.
Mar 22 '08 #8
adamjblakey
133 100+
The easy solution is to modify the value manually (if possible). That way there's no need to make any modifications afterwards, i.e. make sure that all spaces have been removed and the letters are lowercase.

You can also use the replace method to remove spaces, e.g. val.replace(/\s+/g,"-") and the toLowerCase() method to convert a string into lowercase.
thank you, i can not do this manually so would have to be the second option.

how would i go about implementing this into:

Expand|Select|Wrap|Line Numbers
  1. <input type="submit" name="Submit" value="Find" onClick="location.href='http://www.web.co.uk/' + document.getElementById('service').value + '/' + document.getElementById('location').value + '/';" />
Mar 22 '08 #9
acoder
16,027 Expert Mod 8TB
Expand|Select|Wrap|Line Numbers
  1. document.getElementById('service').value.replace(/\s+/g,"-").toLowerCase() 
Mar 23 '08 #10

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

14 posts views Thread by Stan Canepa | last post: by
15 posts views Thread by Stan Canepa | last post: by
12 posts views Thread by Stan Canepa | last post: by
1 post views Thread by Cristisor | last post: by
1 post views Thread by CARIGAR | last post: by
reply views Thread by suresh191 | last post: by
reply views Thread by harlem98 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.