Get Even More Visitors To Your Blog, Upgrade To A Business Listing >>

A simple Poll in PHP

PHP stands for PHP: Hypertext Processor which is a server-side scripting language and it processes HTML Forms outputs.The basic syntax for PHP is:-

echo "Hello World!";
?>

Now i'm giving you a simple PHP poll script which you can use anywhere in your website as it is an open source script.
So for this you will need two pages: index.php and poll.php

Index.php- Now put the following code in your index.php file.







Do you like PHP?




Yes:


No:





poll.php- Now put the following code in your poll.php file.


$vote = $_REQUEST['vote'];
$filename = "poll_result.txt";
$content = file($filename);
$array = explode("||", $content[0]);
$yes = $array[0];
$no = $array[1];
if($vote == 0)
{
$yes = $yes + 1;
}
if($vote == 1)
{
$no = $no + 1;
}
$insertvote = $yes."||".$no;
$fp = fopen($filename,"w");
fputs($fp,$insertvote);
fclose($fp);
?>


This post first appeared on Latest Free Softwares & PHP Scripts, please read the originial post: here

Share the post

A simple Poll in PHP

×

Subscribe to Latest Free Softwares & Php Scripts

Get updates delivered right to your inbox!

Thank you for your subscription

×