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

  • SEARCH
  • Home
  • 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 6757187
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T13:36:58+00:00 2026-05-26T13:36:58+00:00

I’d like to submit a form using GET but without passing the value of

  • 0

I’d like to submit a form using GET but without passing the value of an input field in the URL.

(Some background may be helpful: I’d like to use a form so that the user can enter their name and press Enter in order to proceed, but all I actually want them to do is go to the next page, and it’s important the URL doesn’t have parameters in.)

Currently the displayed URL of the next page /nextpage?username=fred:

<form name="entername" action="/nextpage" method="get">
<label for="name">Enter your name: </label>
<input id="username" name="username"><br/>
<input id="submitme" type="submit" value="Submit" class="button"></form>

Is there a way it could go simply to /nextpage instead?

I guess “use POST” is one answer, but I’d rather avoid that if possible (because then if the user refreshes the next page, they get a scary ‘Resubmit information?’ alert).

So I’m just wondering if there’s any other way besides POST.

  • 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-26T13:36:59+00:00Added an answer on May 26, 2026 at 1:36 pm

    The proper solution will be to make a POST request, and when you process it, to redirect the user to the answer page, thus causing the user’s browser to make a GET request to it.
    This ensures that if the user refreshes his answer page, it will not cause a resubmition alert . See more detailed description of this POST/REDIRECT/GET pattern

    The somewhat hacky solution will be to use onsubmit javascript handler, which will set some cookies reflecting the form input fields, and then will remove the fields, so that they will not appear in the user’s urlbar. The server should then read the submited values from the cookies.

    Here is an example of the cookie hack, using jquery and a php script as a backend processor:

    <?php
    //unsets the cookie:
    setcookie('username', "", time() - 3600);
    ?>
    <!DOCTYPE html>
    <body>
    <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.5.2/jquery.min.js"></script>
    
    <form name="entername" action="" method="get">
        <label for="name">Enter your name:       </label>
        <input id="username" name="username"><br/>
        <input id="submitme" type="submit" value="Submit" class="button">
    </form>
    
    <script>
    function js_setcookie(c_name,value){
        document.cookie=c_name + "=" + escape(value);
    }
    
    $(function(){
      $('form').submit(function(){
         var username=$("#username").val();
         js_setcookie("username", username);     
         window.location = ""; // "" means GET the same page ... change it to whatever backend URL you want instead, for example "http://..../nextpage" .
         return false; // prevent the default event handler that will make a GET request with a query string in it.
      });
    });
    </script>
    
    <?php
    echo "<pre>";
    var_dump(isset($_COOKIE['username'])?"Cookie: ".$_COOKIE['username']:"Cookie is not set.");
    echo "</pre>";
    ?>
    
    </body>
    </html>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

For some reason, after submitting a string like this Jack’s Spindle from a text
I need to clean up various Word 'smart' characters in user input, including but
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I have some data like this: 1 2 3 4 5 9 2 6
I want to count how many characters a certain string has in PHP, but
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I have just tried to save a simple *.rtf file with some websites and
I'm new to using the Perl treebuilder module for HTML parsing and can't figure
I would like to count the length of a string with PHP. The string

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.