JavaScript Text, Appendix B (Introduction to PHP), pgs 653 - 663
(once completed your pages should resemble assignment 3 example
Reading:
- WARNING: You cannot look at your PHP files or your pages that contain PHP from your hard drive unless you
install PHP on your computer. You absolutely must upload your files to view them correctly. The class server
does support PHP.
- See Appendix A in the text page 647 for instructions on installing PHP. This is not required. You can always
upload your files to the server to test your PHP. Just remember, you must upload after each change to test.
I cannot help you with PHP installation.
- On most servers, an html page that contains php will still render and process the php. However, our server was not set up
that way. Since we still don't have everything set up the way I want them, I'm not going to ask for the change. Just name any page
that contains php with the extension php.
Practice:
- Using PHP
- Create an assignment3 folder (no spaces in the name, no uppercase) in your public_html folder.
- helloWorld1.php Page
- Open your template.htm page in your editor.
- Save your template as helloWorld1.php in your assignment3 folder.
- For pages that are really html pages that include a php block of code, you need all the doctype, head, body, etc.
- For pages that are only php statements they will start with <?php and end with ?>
- Add a PHP block that uses the echo statement to display "Hello World". (Just like in JavaScript, you
must include the open and close p tags within the string so that your html page will validate after it renders.
Remember, you have to upload then view in your browser to see if this works.)
- Save your helloWorld1.php document.
- Creating an external PHP file (do not start with your template)
- Including an external php file in your HTML (with the extension php) page.
Project for this assignment
- login.php
- This exercise builds on your money exchange program. You should copy your pages from assignment2 folder
into your assignment3 folder.
- Open your tommorrow.htm page from your assignment1 folder and save it as login.php in your
assignment3 folder.
- Use php to display a message, "Welcome to Express Conversion".
- Display the current date and a message that states that any transaction will be effective with tomorrow's
date.
- Add a text box for the user to enter a username.
- Add a button to the page that shows the value Money Conversion and submits to your currency.htm page.
- Save your page as login.php.
- currency.htm
- Open your currency.htm page.
- Add the coding from your FormProcessing.html page to obtain the username sent from login.php.
- Add a message that shows the username.
- Save the document.
Update your index page:
- Add links on your index page to the pages in your assignment3 folder that are to be graded:
- login.php
- conversion.htm
- currency.htm
- helloWorld2.php
- welcome.php
Uploading:
- Upload your revised index.htm page to the public_html folder.
- Upload your assignment3 folder with the files:
- login.php
- conversion.htm
- currency.htm
- helloWorld2.php
- welcome.php
Testing uploaded pages
- Follow the checklist for grading shown on
the schedule page.
- Make any corrections for any page that does not validate or display correctly.