Jump to content

Recommended Posts

Create a html or PHP script to receive user input in four text fields: a) Full Name (First Last), b) Canadian zip code, c) username. Write a PHP script using PCRE functions and regular expressions to validate these inputs. Your script should output the user inputted values, and return a message indicating which of these four fields has an error, and which of these fields are valid inputs. You are not making any changes to the inputs, but merely checking to see if the inputs are valid or not.

 

a) Full Name: Should not contain any numbers or other characters, should only contain letters.

First and last names should be separated by a space.

Check if the total number of characters in the name is no more than 20 characters (e.g., Adam Taylor).

 

b) Canadian Zip: Should contain 7 characters including a space in the middle after 3 characters, starting with a letter and alternating with numbers (e.g., V6T 1Z4).

 

c) Username: It should be a combination of alphanumeric characters, periods and underscores. (Note: The username cannot be entirely numeric.).

Username should not include any spaces. It should not start or end with a period or underscore. It should be at least 6 characters, and no more than 10 characters.

Link to comment
https://forums.phpfreaks.com/topic/302565-i-need-an-urgent-help-on-this-thing/
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.