|
PERL/CGI What is bad? Help?????
I have problems working with my form in perl. For example in php i use:
<html>
<head></head>
<body>
<h2>Today's Special</h2>
<p>
<form method="get" action="cooking.php">
<select name="day">
<option value="1">Monday/Wednesday
<option value="2">Tuesday/Thursday
<option value="3">Friday/Sunday
<option value="4">Saturday
</select>
<input type="submit" value="Send">
</form>
</body>
</html>
With this script:
<html>
<head></head>
<body>
<?php
// get form selection
$day = $_GET['day'];
// check value and select appropriate item
if ($day == 1) {
$special = 'Chicken in oyster sauce';
}
elseif ($day == 2) {
$special = 'French onion soup';
}
elseif ($day == 3) {
$special = 'Pork chops with mashed potatoes and green salad';
}
else {
$special = 'Fish and chips';
}
?>
<h2>Today's special is:</h2>
<?php echo $special; ?>
</body>
</html>
THis work fine but i need to the same in perl/cgi and i receive errors.
this is the form:
<HTML>
<BODY>
<FORM method="post" action="http://yoursite.com/cgi-bin/testform.cgi">
Name: <INPUT TYPE="text" name="username" size="30">
<BR>
<INPUT TYPE="submit">
</FORM>
</BODY>
</HTML>
this is the cgi:
#!/usr/bin/perl
$uname= $input{'username'};
print "Content-type: text/html\n\n";
print "<HTML><BODY>";
print "Hi $uname, welcome!";
print "</BODY></HTML>";
What i am doing bad? because i receive some error when submit.
Help??????
__________________
angbermu
"Opportunity is never lost just found by someone else"
|