Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 8 of 8
  1. #1
    Regular Coder
    Join Date
    Nov 2002
    Posts
    567
    Thanks
    2
    Thanked 4 Times in 4 Posts

    POSTDATA message on reload.

    When I click on reload to test some change made to css or the page or whatever, I get a message saying that the page contains POSDATA that if resent will repeat the process such as a purchase or whatever and gives me the option to OK or Cancel. I do have a form on the page, but I am not sending any form data, just reloading. Is there something I have going on that I am not aware of? This is one of the forms. When the user clicks on a menu item the value is inserted into the menu action and the 'HOME' page is recalled checking for the value before sending the header and acting accordingly. But once it gets through the switch statement it's done.

    Code:
    //in the navigation bar
    <div id="menuFormDiv" visible="false">
       <form action="" id="menuForm" method="post">
       <input type="hidden" name="menuaction">
       </form>
    </div>
    
    //at the top of the home page
    
    	$thisPage="Home";
    	if (isset($_POST['menuaction'])){
        	switch ($_POST['menuaction']){
        			case 'Register':
        				{
            			require_once "filterClass.php";
            			//require_once "formFunctions.php";		
    					include("register.php");
        				$thisPage="Register";
        				break;
        				}
        			default:
        			    $thisPage="Home";
    					break;
        	} //end switch
    	}//end if
    ?>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
    Is there something I should do to release the post data?
    Scott Stewart
    Always happy to learn from pros.

  • #2
    UE Antagonizer Fumigator's Avatar
    Join Date
    Dec 2005
    Location
    Utah, USA, Northwestern hemisphere, Earth, Solar System, Milky Way Galaxy, Alpha Quadrant
    Posts
    7,691
    Thanks
    42
    Thanked 637 Times in 625 Posts
    It's that annoying thing browsers do when you reload a page that has POST data in the header. When your menu is clicked, I'm assuming you submit that form which is method="POST" which will pack the form data (your hidden field value) into the header of the http request. Your browser sees this when you reload the page and warns you that it's going to re-send that POST data.

    About the only way to avoid this that I know of is to use GET instead of POST, or submit the form to another script and then in that second script call header('location ...') to redirect back to the first page. Of course, if you need to pass data back to the first page from the second page, you'll need to either use a query string or sessions to continue to avoid sending POST data in the header.

  • #3
    Senior Coder
    Join Date
    Mar 2003
    Location
    Atlanta
    Posts
    1,037
    Thanks
    14
    Thanked 30 Times in 28 Posts
    How about using AJAX instead of reloading the page? You can even simplify your work in AJAX by using the AjaxUpdater() which is a part of Prototype, a javascript framework.
    Most of my questions/posts are fairly straightforward and simple. I post long verbose messages in an attempt to be thorough.

  • #4
    Regular Coder
    Join Date
    Nov 2002
    Posts
    567
    Thanks
    2
    Thanked 4 Times in 4 Posts
    I don't know a thing about AJAX. And since this is only happening while I reload to test things then I can live with the hassle.

    Thanks for you responses.
    Scott Stewart
    Always happy to learn from pros.

  • #5
    Senior Coder
    Join Date
    Mar 2003
    Location
    Atlanta
    Posts
    1,037
    Thanks
    14
    Thanked 30 Times in 28 Posts
    Did you even bother to check the link out? Atleast give it a glance, I'm sure you'll be disappointed in yourself for not aspiring to do better. They've written all the code for you to use. Its simple enough for a beginner.
    Most of my questions/posts are fairly straightforward and simple. I post long verbose messages in an attempt to be thorough.

  • #6
    Senior Coder
    Join Date
    Mar 2003
    Location
    Atlanta
    Posts
    1,037
    Thanks
    14
    Thanked 30 Times in 28 Posts
    They have tutorials on the prototypejs.org site BUT if thats not enough try this link at look at the example.

    http://www.ajaxtutorial.net/index.ph...totype-part-2/
    Most of my questions/posts are fairly straightforward and simple. I post long verbose messages in an attempt to be thorough.

  • #7
    Super Moderator
    Join Date
    May 2002
    Location
    Perth Australia
    Posts
    4,108
    Thanks
    11
    Thanked 101 Times in 99 Posts
    Ajax ???? http headers have been around for a while now see cache-control
    resistance is...

    MVC is the current buzz in web application architectures. It comes from event-driven desktop application design and doesn't fit into web application design very well. But luckily nobody really knows what MVC means, so we can call our presentation layer separation mechanism MVC and move on. (Rasmus Lerdorf)

  • #8
    Regular Coder
    Join Date
    Nov 2002
    Posts
    567
    Thanks
    2
    Thanked 4 Times in 4 Posts
    Thanks firepages. That was just what I needed.
    Scott Stewart
    Always happy to learn from pros.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •