View Full Version : Form redirects based on input
gold2040
11-20-2005, 11:34 AM
Hey :)
Is it possible to have this script
http://www.irt.org/script/1558.htm
but with just one input box instead of one for each query
Cheers
gold2040
<form action="default.cgi" onsubmit="
if (this.elements['box1'].value != '') this.action == 'box1.cgi';
else { alert('Please fill something in'); return false; }
return true;">
<input type="text" name="box1">
</form>
gold2040
11-20-2005, 12:15 PM
Hey Twey :)
Thanks, but what I meant was say you put for example
javascript
Perl language
PHP
ASP Scripts
as queries
Would it be possible depending on what query you typed in to redirect to a different webpage with just 1 input box instead of having a box for each query.
Cheers if possible
gold2040
Ah, I see. Yes.
<form action="default.cgi" onsubmit="
var ve = this.elements['box1'].value.toLowerCase();
if (this.elements['box1'].value != '') {
if(ve == "javascript") this.action == 'box1.cgi';
else if(ve == "java") this.action == 'box2.cgi';
else if(ve == "php") this.action == 'box3.cgi';
}
return true;">
<input type="text" name="box1">
</form>
Powered by vBulletin® Version 4.2.2 Copyright © 2021 vBulletin Solutions, Inc. All rights reserved.