Jump to content

jonleow

New Members
  • Posts

    2
  • Joined

  • Last visited

    Never

Posts posted by jonleow

  1. Hi, i have a php file which validate missing input in a form. The code is as follows:

    --------------------------------------------------------------------------------------------
    <?php
    $submit = (mysql_escape_string($_POST['submit']) == "Submit Now") ? true : false;
    $firstName = mysql_escape_string($_POST['firstName']);
    $middleName = mysql_escape_string($_POST['middleName']);
    $lastName = mysql_escape_string($_POST['lastName']);

    if ($submit) {
    if ($firstName == "") {
    echo "Please enter your firstName";
    }
    elseif ($middleName =="") {
    echo "PLease enter your middleName";
    }
    elseif ($lastName == "") {
    echo "Please neter your lastName";
    }
    exit();
    }
    ?>


    else {
    echo "Welcome $firstName $lastName";
    }
    --------------------------------------------------------------------------------------------

    What I wanna do is that i want to provide a link back to my form and i do not want those fields the users have typed in to be empty. What the users keyed in remain and i want the users continue keying the fields they accidentally left out.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.