Jump to content

Recommended Posts

Hello PHP Freaks,

 

I was searching forums to find previous entries of form checking/validation (example: ensuring all form fields are filed out before an email is sent) -------> and if a field is NOT filled in it simply creates a window message to tell the person information is missing AND/OR directly ON THE FORM it points out which fields needs required information.

 

Side note:  Script is already working (just goes back to the form fill out page without a warning message).  However, I find the old script a programmer did ages ago not very functional -- >

 

(snippet for checking fields)

 

    if ($check) {

        $check = check_str($street); 

        if (!$check) $errors = "7";

    }

    if ($check) {

        $check = check_str($city); 

        if (!$check) $errors = "8";

    }

 

Is long and will get longer as I add more additional field checking which I'd like to change (btw, I have no clue why such error checking was done, it's like every check on every field creates an if statement that goes up in number "8" to "9" and "10" etc etc.  Also, if any form fields are not filled out it CURRENTLY just reverts back to an order page without a warning message.  It works, but done nasty.

 

(script snippet for example)

 

    if (!$check) {

        ?>

        <script>location.href="order.phtml?email=<?=$email?>&last_name=<?=$last_name?>&first_name=<?=$first_name?>&street=<?=$street?>&city=<?=$city?>&state_id=<?=$state_id?>

        if (isset($ship_info)) { ?>&ship_info=<?=$ship_info?><? }

        if ($debug) { ?>&error=<?=$errors?><? }

        ?>";</script>

        <?

    } else {

 

then the actual email form occurs and everything processes accordingly.

 

I'm pretty good and looking at prior examples.  If anyone knows of where to find direct links in the forums to previous form validation and putting "window messages" or messages that tell a person which fields need to be filled out directly onto a form --- > that would be great and I can work my head around it with prior code help so I can change the entire form validation to increase functionality.

 

Many thanks for any direction to other links/support or help.

 

Shannon aka Vortexted

Link to comment
https://forums.phpfreaks.com/topic/97861-form-checking-validation/
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.