جرب هذه البرمجية البسيطة
كود PHP:
<?php
header('(anti-spam-(anti-spam-(anti-spam-content-type:))) text/html; charset=windows-1256');
//////////////////////////////////////////
MtRp - TeAm . COM
//////////////////////////////////////////
// a) Adjust the configuration variables to your needs
$file = "votes.txt"; // Name of the file which
// contains the number of
// votes
$title = "ما رأيك بموقعنا ؟؟"; // Title
// of
// the
// poll
$answers = array("رائع !!", // Possible
"جميل", // answers
"جيد",
"غير مقبول نهائيا ");
// b) Copy this code to your PHP file
// c) Copy your PHP file and the votes file defined in
// variable $file to your server using ASCII mode
// d) Make the votes file writable (Windows: adjust
// security, Unix: chmod 777)
/* ###################### INSTALLATION ###################### */
/* ############# SCRIPT (EDIT AT YOUR OWN RISK) ############# */
?>
<h3><?php echo $title; ?></h3>
<p>
<form action="<?php echo $_SERVER["PHP_SELF"]; ?>" method="post">
<?php
//print possible answers
for($i=0;$i<count($answers);$i++){
?><input type="radio" name="vote" value="<?php echo $i; ?>"> <?php echo $answers[$i]; ?><br /><?php
}
?>
<p><input type="submit" value="Vote!"></p>
</form>
</p>
<h3>Results</h3>
<p>
<?php
//read votes
$votes = file($file);
$total = 0;
$vote = $_POST["vote"];
//submit vote
if(isset($vote)){
$votes[$vote] = $votes[$vote]+1;
}
//write votes
$handle = fopen($file,"w");
foreach($votes as $v){
$total += $v;
fputs($handle,chop($v)."\n");
}
fclose($handle);
//print votes
for($i=0;$i<count($answers);$i++){
echo "{$votes[$i]} {$answers[$i]}<br />";
}
?>
</p>
<p>Total: <?php echo $total; ?> votes.</p>
ضعها فى ملف php
وقم بعمل ملف نصى باسم votes.txt
وجرب شغل الملف