Question
index.php string_tester.php String Tester String Tester Name:
index.php
//process $action = filter_input(INPUT_POST, 'action');
switch ($action) { case 'process_data': $name = filter_input(INPUT_POST, 'name'); $email = filter_input(INPUT_POST, 'email'); $phone = filter_input(INPUT_POST, 'phone');
/************************************************* * validate and process the name ************************************************/ // 1. make sure the user enters a name // 2. display the name with only the first letter capitalized
/************************************************* * validate and process the email address ************************************************/ // 1. make sure the user enters an email // 2. make sure the email address has at least one @ sign and one dot character
/************************************************* * validate and process the phone number ************************************************/ // 1. make sure the user enters at least seven digits, not including formatting characters // 2. format the phone number like this 123-4567 or this 123-456-7890
/************************************************* * Display the validation message ************************************************/ $message = "This page is under construction. " . "Please write the code that processes the data.";
break; } include 'string_tester.php'; ?>
string_tester.php
String Tester
Message:
main.css
body { font-family: Arial, Helvetica, sans-serif; } main { width: 450px; margin: 0 auto; padding: 1em; background: white; border: 2px solid navy; } h1 { margin-top: 0; color: navy; } label { display: block; width: 8em; text-align: right; margin: 0 0 .5em; padding: 0 1em; float: left; } input, select { display: block; float: left; margin-bottom: .5em; margin-top: 0; } br { clear: left; }
WRITE THE CODE THAT PROCESSES THE DATA ENTERED BY THE USER 1. Open the index.php file for this application and review the code. Note that it doesn't process the data that's entered into the text boxes 2. Open the string_ tester.php file for this application and review the code. Note that the PHP code that displays the Smessage variable uses the nl2br0 function to convert new line characters to tags. 3. Add the code that uses the data that's entered into the text box controls to display a message that's formatted like this Hello Joel, Thank you for entering this data: Name: Joel Murach Email: joelmurach.com Phone: 415-123-4567 When formatting this message, use escape sequences to insert new line characters. 4. Make sure the user enters a name, but only display the first name in the message. For both the complete name and the first name, capitalize the first letter of the name only. 5. Make sure the user enters an email address, and make sure that this address contains at least one @ sign and one dot character() 6. Make sure the phone number contains at least seven digits, not including formatting characters such as dashes, spaces, and parentheses 7. Test the application to make sure it works correctlyStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started