• Howdy! Welcome to our community of more than 130.000 members devoted to web hosting. This is a great place to get special offers from web hosts and post your own requests or ads. To start posting sign up here. Cheers! /Peo, FreeWebSpace.net
managed wordpress hosting

PHP Question

Sikes

New Member
Ok, I am making a "Gay Test". I have the form action to a PHP file, but when I want to calculate the "Gayness", it shows up as zero!

Consider the following code:
PHP:
<?php
$Gayness = 0;
if(Question1 == "gay") { $Gayness++; }	
echo "You are $Gayness % Gay!";
?>

This is just an example of what I want, but even when I do that, it prints "You are 0 % Gay!" to the screen instead of 1...

The form that it's recieving input from is all radio buttons, did I do the "if" thing wrong or something?

I am going to post this unfinished "Gay Test" online, so you can see what the from looksa like.

URL : http://projectx.megabytestored.com/unrelated/gaytest.html


Sikes
 
That's because:

if(Question1 == "gay") { $Gayness++; }

should be:

if($Question1 == "gay") { $Gayness++; }
 
Ahhhhhhh! :devious2: I knew it was some little thing I missed! Ahhhhh!


Thanx Hayama-kun!

I hope everyone will take my tests when their dome! I'm ginna have the gay test, the *mean guy* test and the *female dog* test! ;)
 
Originally posted by Sikes
Ok, I am making a "Gay Test". I have the form action to a PHP file, but when I want to calculate the "Gayness", it shows up as zero!

Consider the following code:
PHP:
<?php
$Gayness = 0;
if(Question1 == "gay") { $Gayness++; }	
echo "You are $Gayness % Gay!";
?>

This is just an example of what I want, but even when I do that, it prints "You are 0 % Gay!" to the screen instead of 1...

The form that it's recieving input from is all radio buttons, did I do the "if" thing wrong or something?

I am going to post this unfinished "Gay Test" online, so you can see what the from looksa like.

URL : http://projectx.megabytestored.com/unrelated/gaytest.html


Sikes

just another tip, use this :
PHP:
$Gayness = " 0" ;
cuz with " " its a string, and without, is a boolean
:)
 
It's an integer, not a string, and 0 is not exactly a boolean value. It's an integral value, and boolean values are mere subsets of integers.
 
Back
Top