Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8422845
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T03:34:12+00:00 2026-06-10T03:34:12+00:00

When I click on share on a users link..It shares that post fine, yet

  • 0

When I click on share on a users link..It shares that post fine, yet it posts it twice. I’ve checked firebug and when clicked (Once) it shows up two POST requests, inserts two posts to the database and then shows them in the users feed.
I really don’t understand where I’m going wrong.

SHARE LINK

echo'<a class="sharelink" title="Share '.$poster_name['fullusersname'].'s status" href="#"
 data-streamitem_creator='.$streamitem_data['streamitem_creator'].'
 data-streamitem_target='.$_SESSION['id'].'
 data-streamitem_content='.$streamitem_data['streamitem_content'].'
 data-streamitem_type_id=4>Share</a>';

AJAX

$(document).ready(function() {
    $('.sharelink').click(function(e) {
        e.preventDefault();
        var streamitem_creator = $(this).data('streamitem_creator');
        var streamitem_target = $(this).data('streamitem_target');
        var streamitem_content = $(this).data('streamitem_content');
        var streamitem_type_id = $(this).data('streamitem_type_id');

        $.ajax({
            type: "POST",
            url: "../include/share.php",
            data: {
                streamitem_creator: streamitem_creator,
                streamitem_target: streamitem_target,
                streamitem_content: streamitem_content,
                streamitem_type_id: streamitem_type_id
            },
            success: function(data) {
                $(".usermsg").html(data);
            }
        });
    });
});​

SHARE.php

<? 
session_start();
require"load.php";

if(isset($_POST['streamitem_type_id'])&isset($_POST['streamitem_creator'])&isset($_POST['streamitem_content'])&isset($_POST['streamitem_target'])){

user_core::create_streamitem(4,$_SESSION['id'],$_POST['streamitem_content'],1,$_POST['streamitem_creator']);

}
?>

LOAD.PHP

public function create_streamitem($typeid,$creatorid,$content,$ispublic,$targetuser){
    global $mysqli;
            $content = $content;
//          $content =  strip_tags($content);

            if(strlen($content)>0){

    $insert = "INSERT INTO streamdata(streamitem_type_id,streamitem_creator,streamitem_target,streamitem_timestamp,streamitem_content,streamitem_public) VALUES ($typeid,$creatorid,$targetuser,UTC_TIMESTAMP(),'$content',$ispublic)";
            $add_post = mysqli_query($mysqli,$insert) or die(mysqli_error($mysqli));
            $last_id  = mysqli_insert_id($mysqli); 
                if(!($creatorid==$targetuser)){
                    $fromuser= rawfeeds_user_core::getuser($creatorid);
                    $_SESSION['id']==$content;
            }       
            return;
            }else{
            return false;
            }
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-10T03:34:13+00:00Added an answer on June 10, 2026 at 3:34 am

    I can’t see any problem.. By any chance, don’t you have that $('.sharelink').click handler registered twice within your page?

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Scenario: While logged into facebook, I click on a share link on my site.
I have a multiple select box which appears when I click the link 'Share'.
On our website we would like to allow users to share content that they
I'm getting the following exception when I click on the share link for an
In Alfresco Share, when you click the Repository icon in the toolbar, you're taken
I made a camera layout where two buttons existed.A click button and a share
It seems that the WPF Rectangle shape does not have the Click event defined.
Click on this link , you will be redirected to a shopping site. On
about click and submit example below: <form action=url method=post> <input type=text id=input1/> <input type=submit
Built a custom app that will allow users to add jobs to a system.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.