by Carlos A. Pero; last updated 10/22/95
This redirect script will accept input from a FORM, either via METHOD GET or POST, and send a 300-level HTTP status code to redirect the browser to a new URL.
There are two ways to use a FORM in conjunction with this script:
1. A list of URLs with a submit button
<FORM METHOD="POST" ACTION="/scripts/cgi-bin/redirect.pl">
<SELECT NAME="url">
<OPTION VALUE="http://www.ncsa.uiuc.edu/">NCSA
<OPTION VALUE="http://hoohoo.ncsa.uiuc.edu/">HTTPd
<OPTION VALUE="http://www.uiuc.edu/">U of I
</SELECT>
<INPUT TYPE="submit" VALUE="Go to URL">
</FORM>
produces...
In this case, the script will find the input called "url" and redirect the browser to this location.
2. Multiple submit buttons
<FORM METHOD="POST" ACTION="/scripts/cgi-bin/redirect.pl">
<INPUT TYPE="submit" NAME="http://www.ncsa.uiuc.edu/" VALUE="NCSA">
<INPUT TYPE="submit" NAME="http://hoohoo.ncsa.uiuc.edu/" VALUE="HTTPd">
<INPUT TYPE="submit" NAME="http://www.ncsa.uiuc.edu/" VALUE="U of I">
</FORM>
produces...
In this case, the script will find an input NAME that looks like a URL, and redirect the browser to this location.
Either method should work fine, just don't use both within the same FORM.