ZiBaT
=> Peter Levinsky
=> Programming => exercise |
PHP Pages |
Updated : 2015-08-24
|
To create and understand PHP - including forms in HTML.
W3schools HTML tutorials and PHP tutorials
Install the stack to run and provide PHP i.e. install XAMPP
This include a webserver (Apache) a datadase (MySQL) and PHP (= AMP)
Start Netbeans, Create a project 'PHP' -> 'PHP Application'
Make a PHP page - see in the PHP tutorials and run your project
THIS WILL FAIL because you run at the IIS express
You need to move your php-file to the xampp special folder (::root-of-your-xampp-instalation::\htdocs\::your-project-name::) - ex: C:\Program Files (x86)\XAMPP\htdocs\MyFirstPHPProject)
Alternative you place your netbeans-project with root in ::XAMPP::\htdocs
Then you starts the XAMPP -> start Apache
NOW your environment works - next step is a little better exercise - i.e. pages with forms
Make a new PHP-project (possible located in the XAMPP\htdocs folder)
Modify the index.php file to have a form (for HTML-forms see W3C HTML-forms and W3C PHP-forms)
Make a simple page with login-name and phone 'send' this form to welcome.php that prints out the values.
Modify the form to have user-name and password 'send' this to the welcome.php that check the parameters and accept or reject.
What will happen if you change the type to be GET instead of POST? is that wise?
Refactor the index.php to hold a button to create a profile -> send to createProfile.php
The creation of the profile should have following fields name, phone, email, password, confirmed password + a create button (perhaps also a cancel-button) send these information to a ConfirmProfile.php.
See W3C PHP-forms (handling, validation, required, url/e-mail, complete) for improving your form.
To your PHP pages add some css controled styles.
To remember the login use the session objects to save if user is logged in.
see PHP session