PROGRAM DESCRIPTION

You are simply not going to believe this! There was BB poring over your impressive business reports, and in walks Joe Moneybags who offered to purchase her business, lock, stock, and barrel. Somehow, I don’t recall BB having any barrels to rent to beach goers, but that visual could disturb some folks, so we’ll leave that one alone! At any rate, the offer was simply too much to refuse, so it was hasta la vista to the ole beach business. Or should that be “hasta la beacha”?

With the fantastic profit BB made from her business, she has partnered up with an old buddy to get into the small airline business. What with the big airlines suffering from high gas prices—big jets use up gas faster than a baby goes through diapers—BB’s business sense told her that there was a big potential profit just waiting. And she has always been interested in flying. The new business is called BBFBN Airlines. (The FBN refers to the time of day the small jets fly for now, but later they expect to add on daytime flights, if all goes well.)

BBFBN Air has a total of 10 flights available every day, serving points all over the globe country Southeast. And it will be up to you to enable her to sell vast amounts of tickets on her new fabulous online airline site, WWW.BBFBN.COM. (Don’t waste your time, I already tried—it isn’t there J)

SPECIFIC DIRECTIONS

OK, let’s get down to what you really need to accomplish. You should start by creating an HTML form for the online booking system. Your form will allow the buyer to select one airline flight for one or more passengers. I’m going to prescribe certain form elements that you must use on this form, so you can gain experience with them.

Form requirements:

·  Text box: ask for the buyer’s complete name.

·  Radio buttons: present the buyer with a list of 10 flights to any destinations you want to use. For each destination, list the following: destination name (of course), a flight number, the departure time, the flying time, and the charges for a one-way and a round-trip ticket. These charges will be based on a business-class ticket. A first-class ticket will be 20% higher. Indicate that in a note at the bottom of the destination table. The buyer will be allowed to select one flight only (since you are using this button type). (Note: just make all of this up. But for one of the flights, I want these charges: one-way, $219.00; and round-trip, $378.95. That will be for my testing purposes.)

NOTE: values for these first two form inputs are mandatory. For the rest there must be default entries (or in the case of the flight options, no required entries). If the buyer forgets to input their name or to select one of your ten flights, then merely display a message in the browser that they didn’t fill in enough information. You can just tell them to hit the browser’s Back button, and enter the purchase again. Do not sell them a default ticket!

·  Select (pop-up) menu: allow the buyer to select either a one-way or a round-trip ticket for the flight. One-way should be the default.

·  Select (pop-up) menu: ticket type—either business-class or first-class. Business-class should be the default.

·  Text box: how many tickets does the buyer want? The default value should be 1. (If they ask for multiple tickets, you don’t have to test anywhere to see if enough seats are available. Just sell all of them—that’s BB’s philosophy.

·  Select (pop-up) menu: seating preference—either aisle or window seat. (It’s a rather small jet.) Aisle should be the default. (Ordinarily less scary for the average passenger riding with one of BB’s pilots.)

·  Checkboxes: flight options. The buyer can select as many as they want to pay for, but none are required:

o  Trip insurance ($34.95) [It’s for your loved ones!]

o  Meal on the flight ($5.50) [A cold scrumptious box lunch.]

o  Seat warmer ($2.50) [Sometimes the heater falters a bit.]

o  Internet connection ($19.95) [Guaranteed 2K download speeds.]

o  Hotel accommodations at destination ($134.95) [Guaranteed rodent-free.]

·  Submit and Reset buttons

PHP Script. The next challenge will be to write a PHP program to process the buyer’s request and tell them the cost of the purchase. If the buyer purchases multiple tickets, then simply assume that everyone is doing the same thing. They all want meals, Internet connections, etc. So, you can concentrate on costing out one ticket, and then don’t forget to multiply by the number of tickets they want! You don’t have to factor in any sales tax: just use the numbers above.

Most of the selections are single selections, so your PHP program will have access to simple variables to decipher. But the selection of flight options will be as many as the buyer picks. And so you will find yourself needing to process that as an array. In fact, that is mandatory: you are required to use an associative array to process the flight options. The author discusses that starting on page 408, and I also discuss that in my addendum to Chapter 10.

When you have calculated the final cost, send the results back to the user. The display needs to look something like a plane ticket. Use your imagination. But do not simply printf the results on lines back in the browser—no way this would be acceptable for any business! You must format the final display in some way that looks at least a bit official, and preferably looks like a ticket that the buyer might be able to print out and board one of BB’s jets. Make sure you list on the “ticket” all the appropriate information, so the user doesn’t think they might have been scammed. I am not going to list a series of data for you to display—you should know by now what’s important to display. The better this looks, the more points you will earn in the “Proper results” column!

The names of both files must incorporate your last name. Name the HTML form name_form5.html, where name is your last name. Same for the PHP program, call it name_program5.php.

TURN IN: for this program you must turn in both files: the HTML form and the PHP program. Zip them together and submit the zipped file (as a .ZIP Windows file). The HTML form should assume that the PHP script is in the same (htdocs) directory, not reside some other place on your hard drive.

Extra Credit(20 pts) At the bottom of your “order page” allow the buyer to select their exact seat(s). Show an interior diagram of the airplane and all seats that are available. Assume that the jet has 15 rows of seats, with 4 seats in each row (2 on each side of the aisle). You can show half of the seats as being taken already. Allow the buyer to click on any open seats. You don’t have to test in the form in case they select too many. Just pass the seating data to the server and then indicate on the final display the actual seats they will be occupying.

Page 2 of 2