Jump to content

Recommended Posts

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

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>

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.

Guest
This topic is now closed to further replies.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.