Question

<?php    if(isset($_GET['submit'])){ //sanitize the input        /* Check the error from the input: if...

<?php

   if(isset($_GET['submit'])){

//sanitize the input
      
/* Check the error from the input:
if input from user is empty
-> get an error string variable
if input is not empty
-> use preg_match() to match the pattern
$pattern = "/^[1-9][0-9]{2}(\.|\-)[0-9]{3}(\.|\-)[0-9]{4}$/";
-> if it's a matched, get a success string variable
*/
      
   }
?>
<!doctype html>
<html lang="en">
<head>
<!-- Required meta tags -->
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">

<!-- Bootstrap CSS -->
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css" integrity="sha384-JcKb8q3iqJ61gNV9KGb8thSsNjpSL0n8PARn9HuZOnIxN0hoP+VmmDGMN5t9UJ0Z" crossorigin="anonymous">
<link rel="stylesheet" href="">
<title>Lab 2-Part1</title>
</head>
<body>

   <form action="" class="main-form needs-validation">
<div class="form-group">
<label for="numbers">Phone Number</label>
<input type="text" id="numbers" class="form-control" value=<?php //use PHP to print out the value the use typed in if any ?>>
<small class="form-text text-muted">xxx.xxx.xxx or xxx-xxx-xxxx</small>
<!-- Set a condition
if there is an error string variable, print out the string in PHP
if there is a success string variable, print out the string in PHP
-->
      <div class="alert alert-danger">
          Must enter a valid phone number! <!-- should be from an error string variable -->
          </div>
          <div class="alert alert-success">
          Phone number is valid! <!-- should be from an error string variable -->
          </div>
</div>
  
<button type="submit" class="btn btn-primary" >Submit</button>
</form>

<!-- Optional JavaScript -->
<!-- jQuery first, then Popper.js, then Bootstrap JS -->
<script src="https://code.jquery.com/jquery-3.5.1.slim.min.js" integrity="sha384-DfXdz2htPH0lsSSs5nCTpuj/zy4C+OGpamoFVy38MVBnE+IbbVYUew+OrCXaRkfj" crossorigin="anonymous"></script>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/umd/popper.min.js" integrity="sha384-9/reFTGAW83EW2RDu2S0VKaIzap3H66lZH81PoYlFhbGU+6BZp6G7niu735Sk7lN" crossorigin="anonymous"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/js/bootstrap.min.js" integrity="sha384-B4gt1jrGC7Jh4AgTPSdUtOBvfO8shuf57BaghqFfPlYxofvL8/KUEfYiJOMMV+rV" crossorigin="anonymous"></script>
</body>
</html>

//Sign-up form

Students must:

  • Have a form that contains at least 2 input fields: username and password.
  • The error message or success message are hidden before the user click submit buttons.
  • You should apply some rules for the format of either username or password.
    • You can search google for the pattern you’d like to have on your website
    • User preg_match() function to match the pattern and the form data
  • There should be messages:
    • Error message for empty field.
    • Error message if there is invalid username/password
    • If there is no error, display a success message saying that the user signed up successfully.

Homework Answers

Know the answer?
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for?
Ask your own homework help question
Similar Questions
For this assignment, create an html page that has a login form. The form should have...
For this assignment, create an html page that has a login form. The form should have 3 input elements -- 1. This should have a type text for the user to enter UserName 2. This should have a type password (like text except cannot see the text that is typed in), for the user to enter password. 3. Submit button (type submit, as we did in class on 2/6). The form method should be set to POST and the action...
Create an application that will give valuable advice to future students from someone (you!) who is...
Create an application that will give valuable advice to future students from someone (you!) who is close to graduation. However, only end-users who have their credentials validated against the database (which uses encrypted passwords) are allowed entry. ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- advice_ddl.sql CREATE DATABASE advice; USE advice; CREATE TABLE users ( id int primary key auto_increment, username varchar(255), password varchar(255) ); -- insert a row into the users table: -- username = foo -- password = bar INSERT INTO users (username, password) VALUES...
Hi, there. A question about web development. I'm using the jquery to try the reset method...
Hi, there. A question about web development. I'm using the jquery to try the reset method in an input form in the PHP file but it didn't work. Here is a part of my code. <div id='signbox' class='modal-window'> <form id= 'signF' method='post' action='centerControl.php'> ... <input id='resetSign' type='button' value ='Reset'>; ... </form> </div> <script> $(document).ready(function(){ $("#resetSign").click(function(){ $("#signF")[0].reset() }); }); </script> And one more question that I'm a new player so what kind of tool I can check all my jquery PHP...
For this assignment you'll be creating an application that has the user input a subtotal, tax...
For this assignment you'll be creating an application that has the user input a subtotal, tax rate and tip percentage and then displays the sales tax, tip amount and the total. You'll use JQuery instead of the getElementByX functions AND you will display all messages on the page (no alert or prompt boxes) The starter file is based off of the Lab 2 sales_tax application. Feel free to borrow code from your lab solution but realize you will need to...
Java Script I need the code to produce these 3 output. I can only get it...
Java Script I need the code to produce these 3 output. I can only get it to produce input #3 I need it to produce the following: // Input #1: // http://www.example.com // Output // http://www.example.com // Input #2: // http://www.example.com?name=r2d2 // Output // http://www.example.com // name: r2d2 // Input #3: // http://www.example.com?name=r2d2&email=r2d2%40me.com&human=no // Output // http://www.example.com // name: r2d2 // email: [email protected] // human: no THIS IS WHAT I HAVE SO FAR: HTML <!DOCTYPE html> <html lang="en"> <head> <meta...
<!doctype html> <html lang=”en”>   <head>     <title>Principal Calculation Form</title>     <meta charset="utf-8"/>         
<!doctype html> <html lang=”en”>   <head>     <title>Principal Calculation Form</title>     <meta charset="utf-8"/>                   <script src="code.js"></script>   </head>      <body onload="setFocus();">     <div class="container">                                       <div class="main">                                                                                <form action="#" method="post" name="form_name" id="form_id" class="form_class" >                                                                           <h2>--Principal Loan Form--</h2>                                                                                                                                                      <h5>Disclaimer: This software by no mean will precisely predict your mortgage through your lender company.  This Software will only assume the four items below in order to make an educated guess or prediction to your exact mortgage interests amount and the duration of your loan from your lender. <img...
PHP calculator problem Create a calculator class that will add, subtract, multiply, and divide two numbers....
PHP calculator problem Create a calculator class that will add, subtract, multiply, and divide two numbers. It will have a method that will accept three arguments consisting of a string and two numbers example ("+", 4, 5) where the string is the operator and the numbers are what will be used in the calculation. It doesn't need an HTML form, all the arguments are put in through the method. The class must check for a correct operator (+,*,-,/), and a...
In the previous assessment, you used a static set of named variables to store the data...
In the previous assessment, you used a static set of named variables to store the data that was entered in a form to be output in a message. For this assessment, you will use the invitation.html file that you modified in the previous assessment to create a more effective process for entering information and creating invitations for volunteers. Rather than having to enter each volunteer and create an invitation one at a time, you will create a script that will...
This will be my third time submitting this question. THERE SHOULD BE NO USE OF CSS...
This will be my third time submitting this question. THERE SHOULD BE NO USE OF CSS OR SWITCH STATEMENTS IN THE JAVASCRIPT. Even though there is stylesheet in the HTML file do no create a new one. Project Standards: Students will use click events to capture user input. Students will use variables to store information needed by their application and keep track of their program’s state. Students will use conditionals to control project flow. Project Task You will be building...
Challenge 5 Read ALL of the instructions carefully before starting the exercise! Dear Colleague, Earlier today...
Challenge 5 Read ALL of the instructions carefully before starting the exercise! Dear Colleague, Earlier today I built my fourth website using HTML5 and CSS3. This time I wanted to try using CSS float layout options on a website dedicated to my favorite topic: robotics. I wanted my website to look like what is shown in Figure 1 (see below). However, after giving it my best effort, things once again didn’t turn out the way I wanted (see the code...
ADVERTISEMENT
Need Online Homework Help?

Get Answers For Free
Most questions answered within 1 hours.

Ask a Question
ADVERTISEMENT