When my form loads it prints "Please enter your name". That happens before I even press the submit button. And when I press the button, it doesn't do anything because it thinks the name is missing.

Can someone see why?

my $name = param('name'); my $email = param('email'); my $url = param('url'); my $message = param('message'); my $reply = param('reply'); print header, start_html('Contact the webmaster'); if (param('Submit')) { if($name) { if($email) { if($message) { open (MAIL, "|$sendmail -t") or die "Cannot access mai +l"; print MAIL "To: $adminmail\n"; print MAIL "From: $email\n"; print MAIL "Subject: $subject\n\n"; print MAIL "Who: $name\n"; print MAIL "Where: $email\n"; print MAIL "Message: $message\n"; print MAIL "Reply: $reply\n"; close(MAIL) or die "Cannot close sendmail $!"; print <<"ALL"; <table width="369" border="0"> <tr> <td colspan="2">You sent the following message: </td> </tr> <tr bgcolor="#CCCCCC"> <td width="75">Name:</td> <td width="278">$name</td> </tr> <tr bgcolor="#CCCCCC"> <td>Email:</td> <td>$email</td> </tr> <tr bgcolor="#CCCCCC"> <td>URL:</td> <td>$url</td> </tr> <tr bgcolor="#CCCCCC"> <td>Message:</td> <td>$message</td> </tr> <tr bgcolor="#CCCCCC"> <td>Reply:</td> ALL if($reply) { print "<td>yes</td>"; } else { print "<td></td>"; } print "</tr></table>"; exit; } else { print "<font color=red>Please fill in a message.</font>\n"; }} } else { print "<font color=red>Please fill in your email address.</fon +t>\n"; } } else { print "<font color=red>Please fill in your name.</font>\n"; } print <<"ALL"; <table width="469" border="1" align="center"><form method="POST" actio +n=""> <tr> <td><p>Thank you for visiting my site. If for any reason you want +to contact me, whether it be for site bugs, custom work or just a &qu +ot;Hey, you!&quot;, please feel free to contact me. </p> <p>If you request a reply, expect it within the next 12-24 hours. +</p></td> </tr> <tr> <td bgcolor="#CCCCCC">Name: </td> </tr> <tr> <td><input name="name" type="text" id="name"></td> </tr> <tr> <td bgcolor="#CCCCCC">Email:</td> </tr> <tr> <td><input name="email" type="text" id="email"></td> </tr> <tr> <td bgcolor="#CCCCCC">URL:</td> </tr> <tr> <td><input name="url" type="text" id="url"></td> </tr> <tr> <td bgcolor="#CCCCCC">Message:</td> </tr> <tr> <td><textarea name="message" cols="40" rows="5" id="message"></tex +tarea></td> </tr> <tr> <td><input name="reply" type="checkbox" id="reply" value="checkbox +"> Do you want a reply? (checked = yes) </td> </tr> <tr> <td bgcolor="#CCCCCC"><div align="center"> <input type="submit" name="Submit" value="Submit"> </div></td> </tr> </form></table> ALL


"Age is nothing more than an inaccurate number bestowed upon us at birth as just another means for others to judge and classify us"

sulfericacid

In reply to Form problems by sulfericacid

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.