For example: to attract visitors you can just make a poll like this:
Who is the sexiest actor of this month?
a. Goat
b. Monkey
c. Cow
d. No idea
Everything is up to you. in this session we will learn about how the tricks to make a simple poll using php.
1. Preparing Images for polling
Here we will try to create a poll script that displays the three possible answers. Before you begin, prepare 3 pieces of the image with size 1x1 pixels with each color of red, green, and blue. You can use Adobe Photoshop to create this image, and save each image in gif format that is by name r.gif, g.gif, b.gif. usefulness of the third image is a chart for the choice of 1.2 dan3.
The next session we start coding.
2. Create database Polling
First create a poll table in MySql,
| CREATE TABLE poll ( pil1 int (100) NOT NULL DEFAULT '0', pil2 int (100) NOT NULL DEFAULT '0', pil3 int (100) NOT NULL DEFAULT '0', ) TYPE=MyISAM; INSERT INTO 'poll' ('pil1', 'pil2', 'pil3') VALUES ('0', '0', '0') ; |
3. Make Home Page of Form PollingThen to display the choices, we make poll.php files written with pure HTML.
Below is the source of the poll php:
| <html> <head> <title>Membuat Daftar POLLING</title> <meta http-equiv="Content-Type" content="text/html"; charset=iso-8859-1> </head> <body> <body bgcolor="#FFFFFF" text="#000000"> <table width="100%" border="0" cellspacing="2"> <tr> <td valign="top" height="127"> <form name="form1" method="post" action="result.php?vote=ok"> Pertanyaan polling <br> <input type="radio" name="pil" value="satu"> Setuju banget<br> <input type="radio" name="pil" value="dua"> Tidak Setuju<br> <input type="radio" name="pil" value="tiga"> Idem<br> <input type="submit" name="submit" value="submit"> </form> </td> </tr> </body> </html> |
If run on a browser it will appear as shown below:
To file poll.php, as usual we create a form to do a poll. Seprtinya there will be no difficulty in making it because it only required an understanding of their HTML tags only.
Good luck boys....!!!


0 comments:
Posting Komentar