Specifications
<input type=radio name=vote value=”John Smith”>John Smith<br>
<input type=radio name=vote value=”Mary Jones”>Mary Jones<br>
<input type=radio name=vote value=”Fred Bloggs”>Fred Bloggs<br><br>
<input type=submit value=”Show results”>
</form>
</body>
The output from this page is shown in Figure 19.7.
Generating Images
C
HAPTER 19
19
G
ENERATING
IMAGES
421
LISTING 19.4 Continued
FIGURE 19.7
Users can cast their votes here, and clicking the submit button will show them the current poll results.
The general idea is that, when users click the button, we will add their vote to the database, get
all the votes out of the database, and draw the bar chart of the current results.
Typical output after some votes have cast is shown in Figure 19.8.
The script that generates this image is quite long. We have split it into four parts, and we’ll dis-
cuss each part separately.
Most of the script is familiar; we have looked at many MySQL examples similar to this. We
have looked at how to paint a background canvas in a solid color, and how to print text labels
on it.
24 7842 CH19 3/6/01 3:42 PM Page 421










