13.09.2016 Views

PHP and MySQL Web Development 4th Ed-tqw-_darksiderg

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

780 Chapter 32 Generating Personalized Documents in Portable Document Format (PDF)<br />

Asking the Questions<br />

The file index.html is straightforward. It needs to contain an HTML form asking<br />

the user for his name <strong>and</strong> the answers to a number of questions. In a real assessment<br />

application, you would most likely retrieve these questions from a database. Here, you<br />

focus on producing the certificate, so you just hard-code some questions into the<br />

HTML.<br />

The name field is a text input. Each question has three radio buttons to allow the user<br />

to indicate his preferred answer.The form has an image button as a submit button.<br />

The code for this page is shown in Listing 32.1.<br />

Listing 32.1<br />

index.html—HTML Page Containing Quiz Questions<br />

<br />

<br />

<br />

<br />

Certification<br />

<br />

You too can earn your highly respected <strong>PHP</strong> certification<br />

from the world famous Fictional Institute of <strong>PHP</strong> Certification.<br />

Simply answer the questions below:<br />

<br />

Your Name <br />

What does the <strong>PHP</strong> statement echo do?<br />

<br />

<br />

Outputs strings.<br />

<br />

Adds two numbers together.<br />

<br />

Creates a magical elf to finish writing your code.<br />

<br />

What does the <strong>PHP</strong> function cos() do?<br />

<br />

<br />

Calculates a cosine in radians.<br />

<br />

Calculates a tangent in radians. <br />

<br />

It is not a <strong>PHP</strong> function. It is a lettuce. <br />

<br />

What does the <strong>PHP</strong> function mail() do?

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!