PHP help

File 1


Do you prefer using contractor or do it your self?


File 2
if($_COOKIE[‘poll’] == 1)


die (“you’ve already voted in this poll”);


echo ‘Thank you for your vote’;

$vote = $_REQUEST[‘vote’];

//get content of textfile
$filename = “poll_result.txt”;
$content = file($filename);

//put content in array
$array = explode("||", $content[0]);
$yes = $array[0];
$no = $array[1];

if ($vote == 0)
$yes += 1;
if ($vote == 1)
$no += 1;

//insert votes to txt file
$insertvote = $yes."||".$no;
$fp = fopen($filename,“w”);

Results: Do you prefer using contractor or do it your self?

contractor: <?php echo(100*round($yes/($no+$yes),2)); ?>%
myself: <?php echo(100*round($no/($no+$yes),2)); ?>%
Number of votes: <?php echo ($yes+$no); ?>


File 3
text file.txt = to save results

]Hello, Ill try to be as specific as i can, I am trying to use the code above as i have learned from w3 schools and i am trying to figure out how i can add a text link on my poll to linnk to the results without actualy adding another value to the total amount of votes… Just a link to the results. I am a new programmer and i love trying to learn but as you know examples are very helpfull. Any help is greatly appreciated

Can some one please help me?

Ha, Fingured it out myself, Thanks for all the help

Creig, next post, try to make the SUBJECT something that pertains to your problem, not just a general “php help”. Also, if you solve it yourself, tell the rest of us what you did to fix it so that the next person with the same trouble will have the answer.

Glad you solved it! Hope we can help you next time, lol… Always fun to figure it out yourself !!!

my sensei tells us:

“knowledge earned is much greater than knowledge given”

He is correct…


Sponsor our Newsletter | Privacy Policy | Terms of Service