Good day all i am learning CGI using perl and i developed simple script that redirect a user based on form selection to a given website. the code follows below.
if($query->param('op') eq "ds") { print $query->redirect($query->param('website')); }else { print" <html><head><title>Web redirection</title></head> <body> <form action=\"redirect.pl\" method=\"post\" > <fieldset> <legend>Kindly select a website to visit</legend> <strong>Select a website form the list:</strong> <select name=\"website\"> <option value=\"www.sedocaonline.com\">Sedocaonline.com</option> <option value=\"http://www.yahoo.co.uk\">Yahoo.co.uk</option> <option value=\"http://www.play.com\">play.com</option> </select> <input type=\"hidden\" name=\"op\" value=\"ds\" > <input type=\"submit\" name=\"submit\" value=\"Browse the web\"> </form> </body> </html>"; }
The issue here is the code does not redirect the user to the selected website it gives this respond code on the browser.
Status: 302 Found Location: www.sedocaonline.comPlease i kindly need your assistance and comments thanks in advance.
In reply to CGI redirection by 5plit_func
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |