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 617645
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T18:27:30+00:00 2026-05-13T18:27:30+00:00

So let me explain: I basically want so when you post a comment, (i

  • 0

So let me explain:

I basically want so when you post a comment, (i use a js/jquery script to send string to insert.php which inserts to the database) you will receive 2+ points. Now i have done so you get +2 points, BUT i want to display a message like stackoverflow. I already know how to display a message like stackoverflow, but in somehow i need to send from insert.php(after you inserted), this:

<div id='message' onclick="closeNotice()" style="display: none;">
Hey, <b><? echo $pusername; ?></b> - You've just got +<? echo $gpm; ?> points for your comment!
<a href="#" class="close-notify" onclick="closeNotice()">X</a>
</div>

to index.php..

I was thinking of maybe coding into my current script(that are sending string to insert.php) that it should find #message and throw it in #box (div called “box” in index.php).

But how should i do this? Should i like, after you got through insert.php, then you activate a function in javascript that does:

function showmessage()  { 
    $("#box").html(data).find("#message").fadeIn("slow")
}

and as i said you activate the script doing:

<script type="text/javascript" language="javascript">
showmessage();
</script>

after you succesfully have inserted to database and gived points to the user?
Ive just tested this, and i cant get it to work.
my site is integrated with sessions from the phpBB login (phpBB forum i’ve got), so i don’t think i can use $_SESSION.
And the insert.php is opened in a frame.
My problem is that the action, and the displaying of the confirmation take place on different pages.

  • 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-05-13T18:27:30+00:00Added an answer on May 13, 2026 at 6:27 pm

    If I understand you correctly, your problem is that the action, and the displaying of the confirmation take place on different pages.

    One approach to do this is to store the message that is to be displayed on the next page in the user’s session:

    // insert.php
    $_SESSION["user_message"] = "You were awarded +2 points.";
    

    and output it on the following page:

    // thankyou.php
    echo $_SESSION["user_message"]; // Or show the box, or whatever
    $_SESSION["user_message"] = null; // Clean up
    

    the potential downside to this is that if the user has two or more pages/tabs of your site open, and navigates a lot across them, the message may appear in the wrong context. For example, if I click “save” in tab A, and refresh tab B, it could happen that the message intended for tab A is displayed in tab B.

    You could help that by adding a randomly generated key to the message’s variable name, and passing that key on to the page you want to display the message on:

    // insert.php
    $key = "123456"; // Insert random generation method here, e.g. using rand()
    $_SESSION["user_message_$key"] = "You were awarded +2 points.";
    header ("Location: thankyou.php?message=$key"); // Pass the key to the next page
    
    // thankyou.php
    $key = $_GET["message"]; // No sanitation necessary here AFAICS
    echo $_SESSION["user_message_$key"]; // Or show the box, or whatever
    $_SESSION["user_message_$key"] = null; // Clean up
    

    This is very elegant because

    • the message you want to display remains in your internal session store, and at no point is passed on in the browser, reducing the risk of security holes and such.

    • by unsetting the session variable, you make sure the message is shown only once, even if the user reloads the page.

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

Sidebar

Ask A Question

Stats

  • Questions 314k
  • Answers 314k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer If the JVM exits while the try or catch code… May 13, 2026 at 11:05 pm
  • Editorial Team
    Editorial Team added an answer Use System.IO.Path.GetFileNameWithoutExtension instead of a regular expression. static void Compare(string… May 13, 2026 at 11:05 pm
  • Editorial Team
    Editorial Team added an answer Jquery select boxes http://www.texotela.co.uk/code/jquery/select/ will do your dependent boxes for… May 13, 2026 at 11:05 pm

Related Questions

I don't know if there is an official name for this, but I have
Here's the deal: I just started a new job, and source control here is
Is there a good resource for the rules around how the httpHandler path property
I had trouble coming up with a good way to word this question, so
Preamble So, this question has already been answered, but as it was my first

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.