The Cache: Technology Expert's Forum
 
*
Welcome, Guest. Please login or register. September 23, 2019, 02:37:59 AM

Login with username, password and session length


Pages: [1]
  Print  
Author Topic: form to append to url  (Read 2742 times)
craw
Journeyman
***
Offline Offline

Posts: 65


View Profile
« on: May 15, 2008, 08:44:28 PM »

how would one go about doing something like this..
a website with a form- a text box, for the user to fill
then when they hit go a url would launch with the forms text content appended to the end..
similar to a search query-
Logged
craw
Journeyman
***
Offline Offline

Posts: 65


View Profile
« Reply #1 on: May 15, 2008, 08:51:01 PM »

hmm.. or would this be a js question..
...
or an asp question..
lol  ROFLMAO
« Last Edit: May 15, 2008, 09:01:07 PM by craw » Logged
nutballs
Administrator
Lifer
*****
Offline Offline

Posts: 5627


Back in my day we had 9 planets


View Profile
« Reply #2 on: May 15, 2008, 10:59:29 PM »

wouldnt it just be to set the form action="get"
Logged

I could eat a bowl of Alphabet Soup and shit a better argument than that.
perkiset
Olde World Hacker
Administrator
Lifer
*****
Offline Offline

Posts: 10096



View Profile
« Reply #3 on: May 15, 2008, 11:28:41 PM »

Not sure I get you - are you saying that when a user presses a submit button on a form, the content of an input box is appended to a new URL?

If so, this is a JS thang and not tough at all (no form required)

<input id="inputField" type="text">
<input type="button" onClick="execute()" value="Submit">

<script>
function execute()
{
   top.location="http://mydomain.com/anotherurl.html?data=" + document.getElementById('inputField').value;
}
</script>
Logged

It is now believed, that after having lived in one compound with 3 wives and never leaving the house for 5 years, Bin Laden called the U.S. Navy Seals himself.
perkiset
Olde World Hacker
Administrator
Lifer
*****
Offline Offline

Posts: 10096



View Profile
« Reply #4 on: May 15, 2008, 11:29:29 PM »

wouldnt it just be to set the form action="get"

heh... talk about old school. Nice.
Logged

It is now believed, that after having lived in one compound with 3 wives and never leaving the house for 5 years, Bin Laden called the U.S. Navy Seals himself.
vsloathe
vim ftw!
Global Moderator
Lifer
*****
Offline Offline

Posts: 1669



View Profile
« Reply #5 on: May 16, 2008, 06:16:57 AM »

Yeah man, just do it as a GET request

<form action="yourpage (or better yet <? $_SERVER['PHP_SELF'] ?>)" method="GET" >

If you don't want the content to look ugly, like http://yourdomain.com/yourpage?whateverthenameis=someusercontent, then you could put a rewriteRule in your .htaccess for that domain, so it would look pretty.

so instead of:
http://yourdomain.com/yourpage?whateverthenameis=someusercontent

you could use a rewriteRule to make it look like:
http://yourdomain.com/someusercontent.html

You could use the below .htaccess (just an example):
Code:
Options +Indexes
Options +FollowSymlinks
RewriteEngine on
RewriteBase /
RewriteRule ^yourpage?whateverthenameis=(.*)$ $1\.html [L]
Logged

hai
Pages: [1]
  Print  
 
Jump to:  

Perkiset's Place Home   Best of The Cache   phpMyIDE: MySQL Stored Procedures, Functions & Triggers
Politics @ Perkiset's   Pinkhat's Perspective   
cache
mart
coder
programmers
ajax
php
javascript
Powered by MySQL Powered by PHP Powered by SMF 1.1.2 | SMF © 2006-2007, Simple Machines LLC
Seo4Smf v0.2 © Webmaster's Talks


Valid XHTML 1.0! Valid CSS!