Hi everyone, thanks for reading this. I am trying to write some code so that a vote button won't allow a person to vote unless they are registered and logged in. I have this written, but it's not outputting properly. I'm pretty sure I am not encoding the URLS properly within the PHP tags. I can get different buttons/images to display based upon the logged-in status, but I need the URL to change also so they will be thanked for voting or be asked to register after clicking. Make sense? I've googled the crap out of this - I'm probably not using the correct phrasing with my search terms - I'm sure this has been done before.
Any help is appreciated! Thanks!
<?php
ob_start();
session_start();
if(!isset($_SESSION['Username']))
{
$link = ( '<a href="http://www.test.com/signup.php"><img src=/images/register.png" /></a>' );
$alt = 'Please Register';
} else
{
$link = ( '<a href="http://www.test.com/thanks.php"><img src=/images/vote.png" /</a>' );
$alt = 'Vote';
}
?>