justlukeyou Posted February 25, 2013 Share Posted February 25, 2013 Hi, I have been trying to make this work for 3 months now. Firstly I got it working only when the page is loaded. Now it works when both the page is loaded and the button is pressed. But I just cant seem to make it work only when the button is pressed. I somehow need to match these two parts together but I cant seem to be able to do it. <code> if($ID != "") { <input name="followbutton" type="hidden" id="followbutton" value="followbutton" value="true" /> </code> <code> <form action="" method="post" enctype="multipart/form-data"> <?php $ID = mysql_real_escape_string($_GET['ID']); $followerid = intval($_SESSION['userID']); $profileid = $ID; if($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(); } } ?> <div class="followbuttonbox"> <a href="<?php echo $_SERVER['PHP_SELF']; ?>?ID=<?php echo $profileid; ?>"><img src="/images/follow.png" /></a> <input name="followbutton" type="hidden" id="followbutton" value="followbutton" value="true" /> </div> </form> </code> Link to comment https://forums.phpfreaks.com/topic/274938-only-insert-on-image-click/ Share on other sites More sharing options...
Jessica Posted February 25, 2013 Share Posted February 25, 2013 You've made multiple threads for this. Stop double posting. Link to comment https://forums.phpfreaks.com/topic/274938-only-insert-on-image-click/#findComment-1414905 Share on other sites More sharing options...
justlukeyou Posted February 25, 2013 Author Share Posted February 25, 2013 I've spent THREE months on it. I need to get it sorted. Once its sorted its done then. Link to comment https://forums.phpfreaks.com/topic/274938-only-insert-on-image-click/#findComment-1414907 Share on other sites More sharing options...
Jessica Posted February 25, 2013 Share Posted February 25, 2013 That doesn't change our rules. You're not special. Double posting is not allowed. If you were not able to get help for this in three months it's not going to happen now just because you post a 5th thread for it. Link to comment https://forums.phpfreaks.com/topic/274938-only-insert-on-image-click/#findComment-1414908 Share on other sites More sharing options...
justlukeyou Posted February 25, 2013 Author Share Posted February 25, 2013 I have it now so that it only runs when the button is pressed however I want to remove the button and only use the image. Any suggestions please? (Almost there with it) <code> <div class="followbuttonbox"> <a href="<?php echo $_SERVER['PHP_SELF']; ?>?ID=<?php echo $profileid; ?>"><img src="/images/follow.png" name="followbutton" type="submit" /></a> <input name="followbutton" type="submit" value="Follow Button" /> </div> </code> Link to comment https://forums.phpfreaks.com/topic/274938-only-insert-on-image-click/#findComment-1414920 Share on other sites More sharing options...
KevinM1 Posted February 25, 2013 Share Posted February 25, 2013 1. Don't make 4-5 threads on the same problem. If repeat threads are against the rules, you can be certain that making 5 threads on the same topic is against the rules. This is your only warning. 2. or tags are required. You've been here long enough to know that. You have four threads on the same problem. You've been given the tools to solve this problem. Use them. Link to comment https://forums.phpfreaks.com/topic/274938-only-insert-on-image-click/#findComment-1414945 Share on other sites More sharing options...
Recommended Posts