#1
  1. No Profile Picture
    Robert_J_Sherman
    Guest
    Devshed Newbie (0 - 499 posts)
    A few days ago I posed the question about building a required validation set, to check for empty required fields, and to reject those fields should they be empty..

    I received a number of responses, and below is what I finally came to bringing into play.

    In short we build an array of those fields which are "empty" and then loop through them, displaying each empty field, without processing the database entry.

    Just thought I'd share this tid bit of code, if anyone else has been looking for a way to accomplish this task.

    Now all I need to do is assemble an email address validation set, and I'm in business..

    Time to play with the EREG functions of PHP

    //insert validation code here, to valid incoming data before inserting records.
    if (!$city) { $missing[] = "City"; }
    if (!$state_id) { $missing[] = "State"; }
    if (!$zip) { $missing[] = "Zip"; }
    if (!$name) { $missing[] = "Name"; }
    if (!$address) {$missing[] = "Address"; }
    if (!$isp_email) {$missing[] = "ISP Email"; }
    if (!$phone_1) {$missing[] = "Phone1"; }

    if ($missing) {
    for ($i=0; $i < count($missing); $i++) {
    echo "<li>".$missing[$i]."</li>n";
    }
    exit;
    }

    ------------------
    SnR Graphics,
    Low Cost Hosting and Web Development.

    [This message has been edited by Robert_J_Sherman (edited June 15, 2000).]
  2. #2
  3. .Net Developer
    Devshed Novice (500 - 999 posts)

    Join Date
    Feb 2000
    Location
    London
    Posts
    987
    Rep Power
    15

    Now all I need to do is assemble an email address validation set


    just read this:

    http://www2.phpbuilder.com/columns/d...16.php3?page=3

    ------------------
    SR -
    shiju.dreamcenter.net

    "The fear of the LORD is the beginning of knowledge..."

    [This message has been edited by Shiju Rajan (edited June 16, 2000).]
  4. #3
  5. No Profile Picture
    Robert_J_Sherman
    Guest
    Devshed Newbie (0 - 499 posts)
    <BLOCKQUOTE><font size="1" face="Verdana,Arial,Helvetica">quote:</font><HR>Originally posted by Shiju Rajan:

    Now all I need to do is assemble an email address validation set


    just read this:

    http://www2.phpbuilder.com/columns/d...16.php3?page=3
    [/quote]

    Thanks, will take a look at the tutorial.

    I'm rather familiar with the regexp aspect of things, from Perl Programming. It's just a matter of translating it all to PHP..

    I personally think I'm progressing very quickly here, and am really enjoying the PHP experience!

    ------------------
    SnR Graphics,
    Low Cost Hosting and Web Development.

Similar Threads

  1. Replies: 4
    Last Post: February 22nd, 2004, 05:09 PM
  2. Forms - multiple action & required fields!
    By jedi_ralf in forum Beginner Programming
    Replies: 5
    Last Post: February 11th, 2004, 02:40 PM
  3. Tabulating int in db fields and posting to a web page
    By deltatonic in forum MySQL Help
    Replies: 2
    Last Post: January 18th, 2004, 11:33 AM
  4. 'Object required' error
    By aliaga61 in forum ASP Programming
    Replies: 1
    Last Post: January 16th, 2004, 08:48 AM

IMN logo majestic logo threadwatch logo seochat tools logo