Skip to Content
Web Database Applications with PHP and MySQL, 2nd Edition
book

Web Database Applications with PHP and MySQL, 2nd Edition

by Hugh E. Williams, David Lane
May 2004
Intermediate to advanced
820 pages
24h 34m
English
O'Reilly Media, Inc.
Content preview from Web Database Applications with PHP and MySQL, 2nd Edition

Credit Card and Shipping Instructions

When a user finishes adding items to his cart, he usually proceeds to a purchase. In the winestore, the first step after clicking on the Make Purchase button is entering credit card details and optional shipping instructions.

The first steps of the ordering process are encapsulated in the order/order-step1.php and order/order-step2.php scripts shown in Example 19-1 and Example 19-2 respectively. The order/order-step1.php script collects credit card details and delivery instructions, and the order/order-step2.php script validates these and writes them to the orders table if they're valid. On validation failure, order/order-step1.php is re-requested and error messages are displayed above the data entry widgets and the widgets are repopulated with the erroneous data.

The scripts are implemented using the same approach as the customer management processes discussed in Chapter 17. The winestoreFormTemplate class that's described in Chapter 16 is used to display the form, and two session arrays are used to manage previously-entered data and error messages. The validation of credit card details is performed by functions that are discussed in detail in Chapter 9, and stored in the validate.inc include file that's listed in Chapter 16.

The credit card number is stored unencrypted. You can encrypt it using the two-way mcrypt library functions, which aren't installed on most platforms by default and are briefly discussed in Chapter 9. These functions are ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.

Read now

Unlock full access

More than 5,000 organizations count on O’Reilly

AirBnbBlueOriginElectronic ArtsHomeDepotNasdaqRakutenTata Consultancy Services

QuotationMarkO’Reilly covers everything we've got, with content to help us build a world-class technology community, upgrade the capabilities and competencies of our teams, and improve overall team performance as well as their engagement.
Julian F.
Head of Cybersecurity
QuotationMarkI wanted to learn C and C++, but it didn't click for me until I picked up an O'Reilly book. When I went on the O’Reilly platform, I was astonished to find all the books there, plus live events and sandboxes so you could play around with the technology.
Addison B.
Field Engineer
QuotationMarkI’ve been on the O’Reilly platform for more than eight years. I use a couple of learning platforms, but I'm on O'Reilly more than anybody else. When you're there, you start learning. I'm never disappointed.
Amir M.
Data Platform Tech Lead
QuotationMarkI'm always learning. So when I got on to O'Reilly, I was like a kid in a candy store. There are playlists. There are answers. There's on-demand training. It's worth its weight in gold, in terms of what it allows me to do.
Mark W.
Embedded Software Engineer

You might also like

Web Database Applications with PHP, and MySQL

Web Database Applications with PHP, and MySQL

Hugh E. Williams, David Lane

Publisher Resources

ISBN: 0596005431Errata Page