Struggling With 'Social Network' Script

Apologies, its getting late here. Been upto long!

I tried it but doesn’t appear to work. Nothing will print inside this function, is that significant. Is there any form of error messages I can use to see what the issue is?

if(isset($_POST['followbutton']) && $_POST['followbutton'] == 'true'){

What TimeZone are you in then?

I’m off too, far too much wine in me for this time of night/year.

Hi,

As above I did try but it didnt seem to work.

Hi,

Does anyone have any suggestions on what I can try next please. I did have the code working but it ran whenever someone visited the page. Now I am trying to make it so that it runs whenever the button is pressed.



<?php

	

 $followerid = intval($_SESSION['userID']);
        $profileid  = intval($row['id']);
		

	print_r ($followerid);
	print_r ($profileid);
echo '<pre>' . print_r($_SESSION, true) . '</pre>';
	echo print_r ($followbutton);
		echo '<pre>' . print_r($_POST, true) . '</pre>';

	var_dump($_POST['followbutton']);
	
if(isset($_POST['followbutton']) && $_POST['followbutton'] == 'true'){

var_dump($_POST['followbutton']);

print_r ($followerid);
	print_r ($profileid);
	print_r ($_POST['followbutton']);

	echo print_r ($followbutton);
		echo '<pre>' . print_r($_POST, true) . '</pre>';
		
		echo '<pre>' . print_r($_SESSION, true) . '</pre>';
		

	if($profileid =  $followerid) {
        $errors['profileid'] = "This is a test error.";
    }



if(!$errors){
        //Validation of input vars passed, attempt to run query
        //Force vars to be ints to be safe for query statement

		
		    $followerid = intval($_SESSION['userID']);
        $profileid  = intval($row['id']);

        $query = "INSERT INTO `follow` (`user_id`, `follow_user_id`) VALUES ('{$profileid}', '{$followerid}')";
        $result = mysql_query($query);

		
		
        if (!$result)
        {
                $errors[] = "Query: {$query}<br>Error: " . mysql_error();

        }
	}	
	}
	

	
?>


<?php
		print_r ($followerid);
	print_r ($profileid);
	print_r ($followbutton);
	echo print_r ($_POST['followbutton']);
	

		
		
			echo '<pre>' . print_r($_POST, true) . '</pre>';
		
	echo print_r ($followbutton);
	
	?>

       <?php if($errors['profileid']) print '<div class="invalid">' . $errors['profileid'] . ''; ?>



</div>
<div class="followbuttonbox">
<a href="<?php echo $_SERVER['PHP_SELF']; ?>?ID=<?php echo $profileid; ?>"><img src="/images/follow.png" id="followbutton"   /></a>
<input type="hidden"  id="followbutton" value="true" />
</div>