Jump to content
Larry Ullman's Book Forums

Recommended Posts

I am trying to create a string manipulation I have been stuck. Can you look at my code and let me know where I made a mistake.

thank you,

avneet 

 

String Manipulation Functions 
 
In this assignment you need to create a form to allow the user to enter their full name, telephone number, email address, and notes. That information will be sent to a PHP script that will process and display that information applying the following rules: 
1. The full name should be entered in one text box with the first name in the beginning, at least one space, and the last name second. The PHP script will extract and display the first name and last name, making sure there are no leading or trailing spaces and only the first character of the first name and last name should be in upper case and the rest of the characters are lower case. For example if the user enters ‘  abc def   ‘ (without the quotes) the PHP script should display: 
First Name: abc Last Name: def 
 
2. The telephone number should be displayed in the PHP script without the dashes, spaces and any parenthesis. For example if the user enters ‘ (859)  555 – 1111   ‘ (without the quotes) the PHP script should display: 
Phone Number: 8595551111 
3. The email address should be processed by the PHP script and display the username and domain name separately without spaces and all characters should be in lower case. For example if the user enters ‘  Thomas. PAPA @hotmail.com  ‘ (without the quotes) the PHP script should display: 
Username: thomas.papa Domain name: hotmail.com
 
4. The notes should be entered in a text area. PHP will process the notes by first stripping all HTML and PHP tags that the user may have entered, then replacing each space character with a dash () and extract the first 30 characters. After all the above operations have taken place, convert newline characters to break tags and display the string. 

user_input.html

display_user_info.php

Link to comment
Share on other sites

 Share

×
×
  • Create New...