Reply to topic
CGI Script for URL Redirect based on Form List Selection
rogerwpbfl


Joined: 30 Jun 2006
Posts: 5
Location: Palm Beach County, Florida
Reply with quote
A new web design includes a list form with different URLs. The idea is for the form's user to select one of the URLs, click submit, and be taken to the selected URL.

I've found an article entitled 'Redirect a Web Page using a CGI-Script' which identifies a CGI Script to handle this function, but then doesn't identify where to locate or download the file. Link:

http://www.uwo.ca/its/doc/hdi/web/redirect.html

Anyone with experience and a solution will be GREATLY appreciated. Thank you!

Our development site is available from the following URL:
http://76.12.21.227:8092/default.html

The specific form we are attempting to redirect from is the "Free Online Quote" form on the right side.

Thanks,
Roger
Scott M. Sanders


Joined: 26 Aug 2008
Posts: 5
Location: Bucyrus, Ohio, USA
Reply with quote
This is from Adobe Dreamweaver CS3's Jump Menu command:
Code:
<head>
<script type="text/javascript">
<!--
function MM_jumpMenuGo(objId,targ,restore){ //v9.0
  var selObj = null;  with (document) {
  if (getElementById) selObj = getElementById(objId);
  if (selObj) eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0; }
}
//-->
</script>
</head>

<body>
<form name="form" id="form">
  <select name="jumpMenu" id="jumpMenu">
    <option value="/link.html">Link Text</option>
  </select>
  <input type="button" name="go_button" id= "go_button" value="GET QUOTE" onClick="MM_jumpMenuGo('jumpMenu','parent',1)">
</form>
</body>
BMurtagh


Joined: 13 Jan 2009
Posts: 2
Reply with quote
Hi Roger,

After stumbling around the internet for awhile I came across the nph-redir.cgi script at: http://www.ucsf.edu/resources/nph-redir.cgi

I have copied and pasted that into a notepad file and uploaded it to my site to verify that it does work. Once the file has been uploaded into your cgi-bin you will need to SSH into your web hosting account & set 755 permissions on the script. Ex: chmod 755 nph-redir.cgi

I have setup a test site to show you at http://www.bmurtagh.com and here is the code snippet from my test page:


<FORM ACTION="/cgi-bin/nph-redir.cgi" METHOD="POST">
Destination URL?
<SELECT NAME="dest">
<OPTION VALUE="http://www.yahoo.com">Yahoo!
<OPTION VALUE="http://www.netscape.com">Netscape
<OPTION VALUE="http://www.cnet.com">c|net
<OPTION VALUE="http://www.microsoft.com">Microsoft
</SELECT>

<INPUT TYPE="SUBMIT" VALUE="Redirect Me!">
</FORM>

You will want to adjust the options to your liking, but the script should work for you just fine once its in your cgi-bin with the proper permissions. If you have any questions, please do not hesitate to ask. Let me know if you need anything else.
Thanks for the assistance
rogerwpbfl


Joined: 30 Jun 2006
Posts: 5
Location: Palm Beach County, Florida
Reply with quote
Scott, Brendan,

First, thank you both! It never ceases to amaze me the high quality responses an individual gets (for free!!) when they post to a programmer forum, especially HMS' forum of knowledgable and friendly surfers.

Scott, your solution worked like a charm right out of the box. I've successfully tested it on our test page, and will plan to use it moving forward.

Brendan, thank you for your valuable time and research. Seeing Scott's solution with the CS3 code required no additional follow-up scripting, I've decided to use his approach. I am, however, keeping a note of your findings for any possible future applications.

Again, thank you, both!
Roger
rogerwpbfl


Joined: 30 Jun 2006
Posts: 5
Location: Palm Beach County, Florida
Reply with quote
Brendan,

Wow you really went all out with your example site and function.

Thanks again! Much appreciated!!

Roger
CGI Script for URL Redirect based on Form List Selection
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
All times are GMT  
Page 1 of 1  

  
  
 Reply to topic