I really need some help, here I am trying to add a rating script to my php /mysql search results. I am passing this script on to the database each time the user rates on it. Everything is working except when I press a rating it goes to a blank page.... here is the script:
Echo "Rank Me: ";
Echo "<a href=".$_SERVER['PHP_SELF']."?mode=vote&voted=1&{$id}=".$results['id'].">Vote 1</a> | ";
Echo "<a href=".$_SERVER['PHP_SELF']."?mode=vote&voted=2&$id=".$results['id'].">Vote 2</a> | ";
Echo "<a href=".$_SERVER['PHP_SELF']."?mode=vote&voted=3&id=".$results['id'].">Vote 3</a> | ";
Echo "<a href=".$_SERVER['PHP_SELF']."?mode=vote&voted=4&id=".$results['id'].">Vote 4</a> | ";
Echo "<a href=".$_SERVER['PHP_SELF']."?mode=vote&voted=5&id=".$results['id'].">Vote 5</a><p>";
//Now we need to include the info for processing the voting form.
if (isset($_GET['mode']))
$mode = $_GET['mode'];
//We only run this code if the user has just clicked a voting link
if ( '$mode'=="vote")
{
//If the user has already voted on the particular thing, we do not allow them to vote again $cookie = "Mysite$id";
if(isset($_COOKIE[$cookie]))
{
Echo "Sorry You have already ranked that site <p>";
}
//Otherwise, we set a cooking telling us they have now voted
else
{
$month = 2592000 + time();
setcookie(Mysite.$id, voted, $month);
//Then we update the voting information by adding 1 to the total votes and adding their vote (1,2,3,etc) to the total rating
mysql_query ("UPDATE employees SET total = total+$voted, vote = vote+1 WHERE id = $id");
Echo "Your vote has been cast <p>";
}
}
Anybody know how I can fix this???? ANy help will be greatly appreciated!
Echo "Rank Me: ";
Echo "<a href=".$_SERVER['PHP_SELF']."?mode=vote&voted=1&{$id}=".$results['id'].">Vote 1</a> | ";
Echo "<a href=".$_SERVER['PHP_SELF']."?mode=vote&voted=2&$id=".$results['id'].">Vote 2</a> | ";
Echo "<a href=".$_SERVER['PHP_SELF']."?mode=vote&voted=3&id=".$results['id'].">Vote 3</a> | ";
Echo "<a href=".$_SERVER['PHP_SELF']."?mode=vote&voted=4&id=".$results['id'].">Vote 4</a> | ";
Echo "<a href=".$_SERVER['PHP_SELF']."?mode=vote&voted=5&id=".$results['id'].">Vote 5</a><p>";
//Now we need to include the info for processing the voting form.
if (isset($_GET['mode']))
$mode = $_GET['mode'];
//We only run this code if the user has just clicked a voting link
if ( '$mode'=="vote")
{
//If the user has already voted on the particular thing, we do not allow them to vote again $cookie = "Mysite$id";
if(isset($_COOKIE[$cookie]))
{
Echo "Sorry You have already ranked that site <p>";
}
//Otherwise, we set a cooking telling us they have now voted
else
{
$month = 2592000 + time();
setcookie(Mysite.$id, voted, $month);
//Then we update the voting information by adding 1 to the total votes and adding their vote (1,2,3,etc) to the total rating
mysql_query ("UPDATE employees SET total = total+$voted, vote = vote+1 WHERE id = $id");
Echo "Your vote has been cast <p>";
}
}
Anybody know how I can fix this???? ANy help will be greatly appreciated!
