Adding the Review to the Database

Now that you have a list of the books displayed for the user to select from, you need to actually process the request, get the information back from them, and place it into the database. To do this, there are really two parts. First, you need to display the proper data entry form for the user to enter his review information in. Then you need to process that information when he submits it to the server and adds the record. You can use a single script to accomplish this same task by simply...

Downloading and Installing

The first thing you will need to do to use the MySQL system in Python is to download it and install it. As of the writing of this book, the current version of MySQL is 5.0. You can obtain the binaries and installers for the system from www.mysql.com just click the Downloads button and navigate to the Community Server edition. The remainder of the install is fairly automatic. Simply select all of the default values. You will be asked for a root password. Enter one and remember to write it down...

Drawing on the Image

It really isn't a great deal of excitement to create a blank image. What people want to see is some sort of information displayed on the image surface. That's what we live for, as programmers, after all. The PIL modules provide a pretty rich set of functionality for drawing on an image surface, as well as ways in which to load existing images and modifying them. For now, however, let's just consider the various ways in which you might want to draw things on an image canvas. 1. Create a new file...

Getting Information on Python

You might wonder where to find really good information about Python, besides this book. The Internet, of course, is a great source of information, but you always have to know where to look. Here are just a few of the Web sites that you might take a look at for source code, answers to questions, and general tips about the language and the tools. The most obvious source of information is www.python.org, the main site for Python. This is the place you will find the documentation, latest...

The Web Server Apache

The most popular use of Python in the corporate world is for writing scripts to be called from Web pages. In order to use a Web page, of course, you must somehow serve up that page to the user, so that he can interact with your scripts. The serving up of pages is accomplished by a Web server. The most popular open source Web server is the Apache Web Server from the Apache Software Foundation. You can find the Apache Web server at www.apache.org or httpd.apache.org. The Web server itself is...

HTML Elements

Just to illustrate how all of the HTML elements map to their Python equivalents and how you can check to see what you are getting, let's write a very simple program that shows off the various types of HTML elements, such as radio buttons, check boxes, and so forth. Your input form is going to look like the one shown in Figure 13.8, which presents a very simple order form for pizzas. The HTML for this input form looks like this lt TITLE gt Choose your Pizza lt TITLE gt lt FORM lt First, the...

Your First Python CGI Script Hello Apache

The CGI Common Gateway Interface protocol is a standard way for external programs and application environments to interact with Web servers. While a plain HTML file on the Web is static, a CGI program or script is executed at the time that the request is made from the user, and the content is created on the fly. To see how this works, let's create a simple script in Python and have it executed by the Apache Web server. 1. Create a new file using the IDLE editor or your favorite text editor. 2....