Gossamer Forum
Quote Reply
Form design
Hello

We are looking for a form handler or script that will allow the following:


When the user enters a value and hit submit the form will redirect them to:

"http://www.urlto/page.cgi?p=custom_page&the_value_they_entered"

Is that possible?
Regards
KaTaBd

Users plug In - Multi Search And Remote Search plug in - WebRing plug in - Muslims Directory
Quote Reply
Re: [katabd] Form design In reply to
Hi,

Would javascript be ok?

Cheers

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Quote Reply
Re: [katabd] Form design In reply to
Hi,

Heres some sample code (the window.location doesn't seem to be working - but this should give you the general jist of how it should go :))

Code:
<html>

<head>
<meta http-equiv="Content-Language" content="en-gb">
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>New Page 2</title>
</head>

<script>
function gotoPage(theval) {
if (!theval) {
alert("Please enter a value!!");
return false;
} else {
var theurl = 'http://www.google.com/?q=' + theval;
/* alert(theurl);*/
window.location = theurl;
return false;
}
}
</script>

<body>

<form name="gotopage" method="POST" onsubmit="gotoPage(this.form_value.value);">
<p><input type="text" name="form_value" size="20">
<input type="submit" value="Go" name="B1" ></p>
</form>

</body>

</html>

Hope that helps.

Cheers

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Quote Reply
Re: [Andy] Form design In reply to
Hi,

This code should work ( wasn't using .href, and also a "return" =))

Code:
<html>

<head>
<meta http-equiv="Content-Language" content="en-gb">
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>New Page 2</title>
</head>

<script>
function gotoPage(theval) {
if (!theval) {
alert("Please enter a value!!");
return false;
} else {
var theurl = 'http://www.google.com/?q=' + theval;
/* alert(theurl);*/
window.location.href = theurl;
return false;
}
}
</script>

<body>

<form name="gotopage" method="POST" onsubmit="return gotoPage(this.form_value.value);">
<p><input type="text" name="form_value" size="20">
<input type="submit" value="Go" name="B1" ></p>
</form>

</body>

</html>

Cheers

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!