On Sat, 22 Jun 2002 12:52:46 GMT, [EMAIL PROTECTED] (Kyle Babich) wrote: >I'm a beginner. The following is what I wrote: > >#!/usr/bin/perl >print "Content-type:text/html\n\n"; > >@days = ("Sunday","Monday","Tuesday","Wednesday","Thursday", > "Friday","Saturday"); >@months = ("January","February","March","April","May","June", > "July","August","September","October","November", > "December"); > >($sec,$min,$hr,$mday,$mon,$year,$wday,$yday,$isdst) = >localtime(time); >$year = $year + 1900; > >if ($body eq "yahoo") { > >print "<a href=\"http://www.yahoo.com/\">Yahoo</a>\n"; > >} elsif ($body eq "date") { > >print "$days[$wday] $mday $months[$mon] $year\n"; > >}
>Can someone tell me what I did wrong? You are not doing anything to get the "formdata" into your cgi program. A form in the browser must send a parameter and value to your cgi script, and your cgi-script needs to get that value. Your script would work without cgi if you put at the top of your script a value for the variable $body: $body = 'yahoo' or $body='date'; To get your program to accept the cgi get data, you need to put at the beginning of your script: use CGI; $query=CGI::new(); $body = $query->param('body'); Once you get that working with your test.cgi?body=yahoo you can work on making an html form to allow you to enter different values for $body. <FORM METHOD=post ACTION="http://www.example.com/test.cgi"> <INPUT TYPE="text" SIZE=30 NAME="body"> </FORM> Also the way you are printing out your yahoo link, will just print a link to yahoo, not the yahoo web page. If you want to redirect the browser to the yahoo page, you need to do a $url = "http://yahoo.com"; print "Location: $url\n\n"; exit; Good luck. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]