Question: Homework 4 Part 1. Create an html page but CALL it lab1Page1.php. Note the php extention, not html. This is because the server will not
Homework 4 Part 1. Create an html page but CALL it lab1Page1.php. Note the php extention, not html. This is because the server will not work with html pages. There is no php coding on this page. It is just like an html page. Put a form tag within the body of your page. You may choose the name of the form, but make sure that method = "post" and action="lab1.php" Add two textboxes to the form. The first should be named UserName, the second Email. Add text to the page to label the textboxes. Add a submit button. You may choose the name of the button, but make the value="Submit" Save your work and use the browser to view it. DO NOT click the submit button as an error will occur. Make any necessary changes to make it look visually appealing, and resave.
Part 2. Create another page. Save it as lab1.php. Make sure you save it in the same directory as the first page
Part 3. Lecture. Read this first then go to Part 4 Client-side processing is when the computer at which you are sitting and viewing the page (the client) actually processes the code - for example, putting the time and date on the web page. But when this task is done by the server, it is called server-side processing. Sometimes we don't care where the processing is done. As long as both clocks are accurate what difference does it make whether it is the server or the client machine that gives us the time? But soon we will be getting information from a database that is on the server. So the server will have to access the database for us - and this is server-side processing. The language we will use is called php, and we tell the server that we want the processing to be done there by enclosing the code in these brackets . In php, variable names must begin with $, and variables MUST be initialized when they are declared. Remember the textboxes we put on the first page? One was given the name 'UserName' and the other was named 'Email'. The text that the user puts into the textbox called UserName can be picked up on the page called lab1.php by using the following code: php $strUserName = $_POST["UserName"] ?>
and can be displayed by using the following code Name is: php print $strUserName ?> Note the position of the php and ?>. The first part of the line merely displays some text and no tags are required for html. However we then want to print out NOT the word strUserName, but the value of this variable - so we want the server to process this code for us.
Part 4: Write the code to put the value of the textboxes (the text that was written in the textboxes) into the variables $strUserName and $strEmail. This can be done with the following script Write code to display the contents of $strUserName and $strEmail on the page, with appropriate labels. (I showed you how to do this for the name in the lecture above ) Copy these two pages to your htdocs folder in XAMPP Open XAMPP as Administrator, then start Apache Module Use your browser to open the first page by going to http://localhost/lab1Page1.php Enter text into the textboxes, click the submit button If you get an error, you will have to debug and save it again
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
