Create a web page that prompt the user for input, PHP Web Programming

Assignment Help:

Overview

Web pages often need to prompt the user for input and that input will then need to be uploaded to the server, processed, possibly stored, and then some appropriate result sent back. In this assignment, the user is prompted using a HTML form which is submitted to code written in PHP on the server. The PHP code will then validate the data. If the data is validated, then the data is processed and the appropriate actions are done. If the data is not validated, then no further processing of the data occurs and an error is returned. In this assignment, the "error" returned will be a page sent back to prompt the user to correct the error.

Session handling WILL be necessary for this assignment to work. This assignment is not intended to represent a complete credit card checking system. Its purpose is to actually do form processing, server-side form validation checks, re-prompting the user to correct issues, and to actually process data.

Task

This assignment will consist of the following files:

form.php
Prompts the user for the following pieces of information:
name on credit card,

Must be a (single-line) text field.
Names cannot be longer than 30 characters, must be alphanumeric, and spaces are allowed. All other characters are not allowed.
credit card expiry month,
Must be a drop-down box.
The month is listed as a two-digit month (just as it is on your credit card).
Must be validated in the manner of PHP Cookbook Recipe 9.3 & 9.5.
credit card expiry year,
Must be a drop-down box.
Current year to 5 years into the future (i.e., 2010 to 2015).
Must be validated in the manner of PHP Cookbook Recipe 9.3 & 9.5.
credit card type,
Must be a drop-down box.
One of: VISA, MasterCard, American Express.
Must be validated in the manner of PHP Cookbook Recipe 9.5.
credit card number, and,
Must be a (single-line) text field.
Must be validated using PHP Cookbook Recipe 9.19.
person's email address.
Must be a (single-line) text field.
Must be validated using PHP Cookbook Recipe 9.4.
There is a "Make Purchase" button which will submit the form to process.php.
There is a "Clear Purchase Info" button which will submit the form to process.php.
This will be used to wipe out any store form session information.
This gives a way to clear out data when testing... otherwise the session would have to be invalidated.
All fields are required.
Note techniques used in PHP Cookbook Recipes 9.1 and 9.2.
Prevent hacking by:
Using htmlspecialchars() as used in PHP Cookbook Recipe 9.10. This will cause characters to be escaped.
If there is a problem with the form the user will be redirected BACK to this page, so it needs to:
Dynamically generate the form.
If there was no previous form entries submitted, then the form is empty.
If there was a previous form entry submitted (and its contents stored in $_SESSION), then the form is re-populated as follows:
Refer to PHP Cookbook section 9.12 for guidance.
Each field must be populated with the previously entered value.
Each field that is invalid must have a message to that effect in RED next to the field that is invalid. This way the user knows what to correct.
Output a message at the top of the page, "Sorry, your submission was not accepted. Please fix the errors below and resubmit."
process.php
The process.php file must perform all of the validations outlined above in form.php. (No validations are done in form.php).
If the submission was "Clear Purchase Info" then you are to:
clear out ALL stored session information and redirect the browser back to form.php
If everything validates, then you are to:
store the form information in a single entry of $_SESSION using an array (inside of $_SESSION).
store $_SESSION['purchase'] = 'success'
redirect the user to success.php
If there any issues with validation, then you are to:
store the form information in a single entry of $_SESSION using an array (inside of $_SESSION).
store $_SESSION['purchase'] = 'error'
redirect the user to form.php
This page does not output anything --it only redirects.
success.php
Output all stored $_SESSION information from the successful purchase to an HTML page (e.g., with a table).
Clear all stored $_SESSION information.
At the top of the page output, provide a link to form.php.
Please note that the variables set in process.php are needed in both form.php and success.php. Start off by writing form.php to simply output the form first. Then start writing process.php to process the initial submit. From there, you can add the rest of the functionality.

You may do this assignment how you see fit, but, you are expected to use the above PHP Cookbook Recipes to develop the results.


Related Discussions:- Create a web page that prompt the user for input

Drupal website changes needed, Drupal website changes Move a current Dru...

Drupal website changes Move a current Drupal website to another server (requires static IP address). Create an addition of a video library to have the capability to add a vid

Create a connection string to connect to database, Question: (a) What ...

Question: (a) What will be the output of the following extract codes? Describe fully how the program operates. $states_of_the_USA = array (1 => "Alabama", "Alaska", "Arizo

Web app on ruby on rails, WEB APP Laravel PHP, MongoDB, Python Flask, An...

WEB APP Laravel PHP, MongoDB, Python Flask, AngularJS, Celery or Gevent, Bootstrap, But I am likewise open to Ruby On Rails or other tech if reasoning is clear. Desired Skill

Need small php help, Small php help, Need php help I already have some p...

Small php help, Need php help I already have some php files with working code I am seeking someone to modify to get desired results. I will be checking results simultaneously

We need modifications to existing squarespace site, We need Modifications t...

We need Modifications to existing as well as customized squarespace site I have a squarespace site It has been made as well as customized by an agency however I need a some a

Admin panel to upload my html and php templates, Admin panel to upload my h...

Admin panel to upload my html, php, psd templates Project Description: -Upload my psd file and convert -login panel -encryption code -client login panel -to make

Assignment to capture our customers email addresses, web coupon This is ...

web coupon This is a assignment to capture our customers' email addresses or else cell phone numbers by offering a discount coupon. Job description- We are seeking a devel

#web, Ask question Write a PHP program that allows you to: (i) create the ...

Ask question Write a PHP program that allows you to: (i) create the text file "test.txt" (ii) insert the text: "Hello dear" into the file (iii) append the text: "Welcome" to the

Gravity forms wp expert wanted to re-program form, Gravity Forms WP Expert ...

Gravity Forms WP Expert Wanted To Re-Program Form We want a TRUE WordPress/Gravity Forms developer who is expert at customizing a form with a specific UI/Look as well as Feel. O

We need a wordpress expert, We need a wordpress expert I have a wordpres...

We need a wordpress expert I have a wordpress website which have few issues with login and PayPal. Therefore I need a wordpress expert who can solve all those issue tomorrow.

Write Your Message!

Captcha
Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd