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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T17:52:21+00:00 2026-06-12T17:52:21+00:00

I have a page with code… <script language=JavaScript> var link = <img src=’http://www.mysite.com/file.php?var1=firstName&var2=lastName&var3=phone’>; document.write(link);

  • 0

I have a page with code…

<script language="JavaScript"> 
 var link = "<img src='http://www.mysite.com/file.php?var1=firstName&var2=lastName&var3=phone'>"; 
 document.write(link); 
</script>

And I have a “file.php” gets these variables…

$firstName = $_GET['var1'];
$lastName = $_GET['var2'];
$phone = $_GET['var3'];

The problem is… I want to make it safer from refreshing the page. Because these variables are adding into the database. And if you will click “Refresh” in browser with the link from JavaScript, they are adding twice. I think, the best way to use the “POST”. How to do that correctly?

  • 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-12T17:52:23+00:00Added an answer on June 12, 2026 at 5:52 pm

    Well the way you have your code sort of sets it up for this issue. The best ‘solution’ I can think of is a catch on reload:

    window.onbeforeunload = function() {
       return 'Please do not refresh this page';
    }
    

    Beyond that the only other ‘safe’ method is to set a variable to check if the information has been sent to the server already, or a block on the server-side to prevent multiple writing.

    To address your edit:

    You may want to think about a submission via AJAX. You could submit to your handler and get a response back. Then it would be possible to store that (localStorage or Cookies) to prevent it from being submitted again.

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

Sidebar

Related Questions

I am referencing JavaScript as follows on an HTML page: <script type=text/javascript src=http://code.jquery.com/jquery-1.6.1.min.js></script> <script
I have a page setup using code from here: http://www.jigar.net/articles/viewhtmlcontent78.aspx in order to post
Lets say I have a page with this code on it on www.foo.com: <script
I have html page source code with img tags like <p>xyz </p>< img .......
We have link to some page (with html code, on the same domain), that
I have a JSF 2 .xhtml page with javascript in the page code. In
I have a php page with the follow javascript code in it: $(#saveButton).click(function() {
I have a python psp page code is shown below. Currently it only prints
Hi guys I have my endless page js code working great but for some
I have 2 master pages that are nested.this is main master page code for

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.