SitePoint Sponsor |
|
User Tag List
Results 1 to 3 of 3
Thread: Custom form submit
-
Dec 11, 2007, 11:29 #1
Custom form submit
Hi everybody,
I'm trying to figure out how to have a custom form submit. The problem is I have rewritten URLs and need a form to use those "rewritten URLs." So basically, I have input 's' which stands for "search." My form action needs to be this:
Code:mysite.com/index.php/search/*INSERT+THEIR+QUERY+HERE*/
-
Dec 11, 2007, 12:51 #2
- Join Date
- May 2006
- Location
- Central Florida
- Posts
- 2,345
- Mentioned
- 192 Post(s)
- Tagged
- 5 Thread(s)
It is a little unclear what you are trying to do. But, if I understand correctly, you simply need to set the 'action' attribute in your 'form' tag to:
mysite.com/index.php/search/
Have I misunderstood what you are trying to accomplish?
Do you have control over the index.php referenced in your example?
You can interpret the input (GET or POST) and 'reconstruct' the URL, feeding it to a header command as "Location".
Code:ob_start(); $search = $_POST['s']; if($search!="") { header("Location: mysite.com/index.php/search/" . $search); } ob_end();
Don't be yourself. Be someone a little nicer. -Mignon McLaughlin, journalist and author (1913-1983)
►Git is for EVERYONE
►Literally, the best app for readers.
►Make Your P@ssw0rd Secure
►Leveraging SubDomains
-
Dec 11, 2007, 13:34 #3
- Join Date
- Dec 2007
- Posts
- 33
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
It's probably easier to sort this within the rewrite rule on your site. If you didn't write these rules yourself google mod rewrite and .htaccess. It's an easy fix and dosen't require bulky JS in the wire.
I'm presuming your using Apache as your server. If anyone knows how to do this in IIS please post too
Bookmarks