complete php order form with discount code check

This project was awarded to dzmitrij for $50 USD.

Get free quotes for a project like this
Employer working
Awarded to:
Skills Required
Project Budget
$30 - $250 USD
Total Bids
Project Description

This is our initial position:
- there are two simple php files: php1 for an orderform, php2 for checking and confirmation
- php1 is an order form, where the customer can put in his address before ordering.
- there is also a field for "discount code". If the customer has a discount code, he can put it herein to get a discount.
- with a submit button, the php2 is called.

- php2 checks address data for completness.
- check is done with simple "if" queries
- if the address is incomplete, it goes back to order form
- if the address is ok, order will be sent
- discount code is checked manually

This is what we need:
- php3: discount code validation and mark discount code as obsolete
- at submitting the discount code must be validated
- additional we provide a "[url removed, login to view]" file, wich is edited manually.
- this is an example of [url removed, login to view]:
12345678901234;[url removed, login to view];[url removed, login to view]
12374278901233;[url removed, login to view];[url removed, login to view]
82345678421230;[url removed, login to view];
55345685671236;[url removed, login to view];

- [url removed, login to view]:
-- format is text/csv
-- seperator is semicolon ;
-- there is no header line
-- each line is one discount code
-- three fields: fields one/two are predefined, field three is controlled by php3
-- first field is the discount code, alphanumeric, up to 20 charcaters, no spaces
-- second field:expiry date; date format: [url removed, login to view]
-- third field: date of cashing the discount; date format: [url removed, login to view]

- validating with php3:
-- validating must be processed in a separate php3 file. php2 calls the new php3 as a function. php3 returns only true/false (valid/not valid).
-- so the only change in php2 is the new function call to php3 and if the check fail and additional error message.
-- new php3 function:
--- get the customer discount code from php2 as parameter
--- read each line in the csv file and compare with predefined discount codes with our customer discount code until it finds an exact match
--- discount code is only valid if:
---- predefined discount code matches complete with customer discount code (not case sensitive)
---- predefined discount code has same length than customer discount code
---- current date is less or equal than "expiry date" (second field in line)
---- third field in line (discount code) is empty

--- if the discount code is valid:
---- change [url removed, login to view]: php3 write current date in the line with the matched discount code as third field. This mark the discount code as obsolete
---- date format: [url removed, login to view]
---- return true to the calling program as valid discount code and end php3

- leave php1 unchanged
- complete php2:
-- this should the call in php2 look like i.e.:
--- if (php3($discountcode))
--- {
--- // current code for ordering; leave unchanged
--- }
--- else {
--- // new code: error message "discount code invalid"
--- }

Looking to make some money?

  • Set your budget and the timeframe
  • Outline your proposal
  • Get paid for your work

Hire Freelancers who also bid on this project

    • Forbes
    • The New York Times
    • Time
    • Wall Street Journal
    • Times Online