Hi,
I am trying to complete a button which allows someone to follow somone else. It is designed to be a social networking button. I could get the button to work whever the page is loaded which is highly undersirable but I cant make it work when the button is pressed.
I am really stuck on this, does anyone have any suggestions on what I can try to get it to work please.
[code]<?php
$followerid = intval($_SESSION[‘userID’]);
$profileid = intval($row[‘id’]);
if(isset($_POST[‘followbutton’]) && $_POST[‘followbutton’] == ‘true’){
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();
}
}
}
?>[/code]