PDA

View Full Version : Form that adds to the URL


trevo
2007-01-30, 21:12
Hello.

I want to add a kind of client log-in to view photoshoots...

Is it possible to have a text box where they type the name of the shoot, for example the name of the shoot could be "fringefestival" and when they press the pushbutton it adds the name fringefestival to the end of a URL:


http://www.homepage.mac.com/trevo/fringefestival

I'm guessing I'm going to need to script this... As of typing this i'm looking through w3schools for an answer as well.

edit: Moderator can you please edit the subject/title of my thread!!! thanks.

PKIDelirium
2007-01-30, 21:19
Easy, just add the following code to the

trevo
2007-01-30, 21:21
:lol:

I had to post this just for the smiley, thanks for that.

FFL
2007-01-30, 21:33
edit: Moderator can you please edit the subject/title of my thread!!! thanks.
Sure!

You get a whole do-over.

Please post exactly what you would like the new thread title to be.

Thanks!

noleli2
2007-01-31, 21:43
Some quick playing around came up with this:


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"

"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">



<html>

<head>

<title>Form that adds to URL</title>

<script language = "javascript" type="text/javascript">
function goToIt()
{
var theURL = document.URL; // gets current URL
theURL = theURL.substr(0, theURL.lastIndexOf("/") + 1); // pulls off thefilename
theURL = theURL + document.getElementById("shootName").value; // adds the form value to the end of the URL
location.href = theURL; // goes there
}
</script>

</head>



<body>

<form action = "javascript:goToIt()">

<input name = "whatever" id = "shootName" />

<input type = "Submit" />

</form>

</body>

</html>




Good luck!

trevo
2007-02-05, 07:40
Thank you very much, I really appreciate it.