Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6804275
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T19:26:45+00:00 2026-05-26T19:26:45+00:00

Familiar with creating textfields in a form like this example:- Name :<input type=text name=visitor

  • 0

Familiar with creating textfields in a form like this example:-

Name  :<input type="text" name="visitor" /><br /><br />
Email :<input type="text" name="visitormail" /><br /><br />
Phone :<input type="text" name="visitorphone"/><br /><br />

and validating same as in this type of example:-

$vname = $_GET["visitor"];
$vemail = $_GET["visitormail"];
$vphone = $_GET["visitorphone"];

    // VALIDATION INTRODUCTION - THESE ARE THE FORM FIELDS THAT WE REQUIRED THE VISITOR TO FILL IN  
        if(empty($vname) 
        || empty($vemail) 
        || empty($vphone)) 
        { 
        echo "<h2>Go Back and fill in all fields  </h2>\n";
        die ("Use the Go Back button !! ");
        }
        if(!$vemail == "" && (!strstr($vemail,"@") || !strstr($vemail,"."))) 
        {
        echo "<h2>Go Back and enter a valid E-mail Address</h2>\n";
        die ("Use the Go Back button !!");  
        }

The above script works….see this image! Alternate form layout

The Question I have is ???

When the form is created with onfocus textfields as in the following example:-

<input type="text" name="visitor" value="NAME" size="23" onfocus="if (this.value == 'NAME') {this.value = '';}" onblur="if (this.value == '') {this.value = 'NAME';}">

….the above validation no longer works as there is already an entry in the textfield!

Can the above validation be adopted for use in the new onfocus situation?

  • 1 1 Answer
  • 1 View
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T19:26:46+00:00Added an answer on May 26, 2026 at 7:26 pm

    The simplest way would be altering your current script’s if statement like so:

    if((empty($vname) || trim(strtolower($vname)) == 'name')
    || (empty($vemail) || trim(strtolower($vemail)) == 'email') 
    || (empty($vphone) || trim(strtolower($vphone)) == 'phone'))
    

    That should get the job done if you are happy with your current script, but over all you could do a lot better when it comes to your validation as it seems fairly error prone and doesn’t seem that user friendly right now – Then again it is an example script so perhaps that’s on purpose.

    Anyway, like I said, that would be the simplest way with your current script, although not the best way by any means.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm not really familiar with creating generic methods, so I thought I'd put this
I am fairly familiar with creating simple custom controls, but I haven't had this
I am not very familiar with the way of creating a daemon in Python,
I'm creating a web app with Django. Since I'm very familiar with Apache I
I am not familiar with creating android apps by any means. However my company
I'm familiar with the idea of creating a new viewcontroller and pushing it onto
I'm creating a tree to represent a simple language. I'm very familiar with Abstract
I'm creating a custom ViewController. This VC needs to load some data that is
I am creating a sample application using sqlite database unfortunately I am not familiar
I'm new to jQuery. I'm trying to get familiar with it so I'm creating

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.