How to validate basic html form?

From: deko (nospam_at_hotmail.com)
Date: 07/30/04


Date: Thu, 29 Jul 2004 22:55:01 GMT

I have a basic Feedback form - I want to prevent blank entries. The problem
with the below code is that the form still Posts if the 'message' field is
blank. The form will not post if the 'email_address' field is blank,
however. Why doesn't it catch empty 'message' field?

  <form method="POST" action=
   "<?
   $message = $_POST['message'];
   $email_address = $_POST['email_address'];
    if ( empty($message) || empty($email_address) )
    {
    }
   else
    {
    $email = $_REQUEST['email_address'];
    $message = $_REQUEST['message'];
    mail( me@mydomain.com, "My Feedback Form", $message, "From:
$email_address" );
    }
   ?>"
   name="Feedback" style="font-family: Arial, Helvetica, sans-serif;
font-size:12px">
   Email address:
   <input name="email_address" type="text" size="30"/><br />
   Message:<br />
   <textarea name="message" rows="12" cols="25">
   </textarea><br />
   <input type="submit" value="Send" style="font-family: Arial, Helvetica,
sans-serif">
  </form>

Thanks in advance.



Relevant Pages

  • Re: [Xnews] How to score out...
    ... Second trick, you can score multiple entries using double ":" ... which is ridiculous because now *all* of my posts ... > porn spammers that keep posting to the image newsgroups. ...
    (news.software.readers)
  • latest reply to David Lipman from Umwhat
    ... You may like to read my 2 earlier posts to your reply which are the 2 posts ... The entry of whse remains in the msconfig Startup Programs and I have found ... with the entries there that should be removed to remove whse. ... > allow the FTP utility to download the needed files ...
    (microsoft.public.windowsxp.security_admin)
  • Re: - SHOOT IN - Pucker up, Sours Posted
    ... I enjoyed the Shoot In, and although I didn't join as frequently as I'd have liked, when I did I'd try to do a conscientious "critique" of the entries. ... Too many Usenet Poster posts, ... perceptive people have succumbed to the easy targets and self-pleasuring opportunities they present; everyone who counts /knows/ who and what are the irritants. ... Spending so much energy pointing them out, time after time, is not only an irritant in itself, feeding them and increasing their volume, it is deprecatory of other readers' intelligence. ...
    (rec.photo.equipment.35mm)
  • Re: Word Index entry limitations?
    ... I see from other posts ... I don't see any documented limit specifically on the number of index entries ... A multi-document approach is not necessarily out of contention. ...
    (microsoft.public.word.vba.general)
  • Re: What is the longest thread ever?
    ... Does anyone actually read every single one of those entries, ... Is there some kind of Guiness Book record for the longest thread ever? ... obsolete, and when I bought a new one, I couldn't find the newsgroup ... "FellKnight goes pro" was the longest thread on RGP at over 900 posts ...
    (rec.gambling.poker)