0

I'm making a website where users select one of the four options - A, B, C, or D (for simplicity) and press a button to be redirected to a different page (page 2) that uses the selection to display one of the four images at the top.

The selection is stored in a text file using PHP.

Page 2 will read the text file and display the picture based on the value read.

The problem is if the user had previously chosen option A and then presses the back button and chooses option C, the first time Page 2 loads, it will still display the picture for option A. Only after refreshing the page once it will load the correct picture for option C.

I tried to prevent IE from caching the page.. but it was no use.

    <meta http-equiv="CACHE-CONTROL" content="NO-CACHE" />
    <META HTTP-EQUIV="Pragma" CONTENT="no-cache">
    <META HTTP-EQUIV="Expires" CONTENT="-1">

Note: The website only has to work in IE so no need to make it compatible with other browsers...

Anyone know what am I doing wrong here? Or how to prevent the browser from remembering the previous information?

Edited by JameB

4
Contributors
11
Replies
12
Views
5 Years
Discussion Span
Last Post by JameB
0

Did you inspect the header to make sure you implemented the code properly. There are quite a bit of online sites that let you see the results of the header. Check that, just to rule it out as an issue.

0

Did you inspect the header to make sure you implemented the code properly. There are quite a bit of online sites that let you see the results of the header. Check that, just to rule it out as an issue.

Hmm, the problem is I'm not running this on a publicly accessible server. It will be run locally with a USB web server.

0

I set timeouts in .htaccess to 5secs for anything that needs it, is the usb server a wamp/lamp system?

<IfModule mod_expires.c>
ExpiresActive On
ExpiresByType text/html "access plus 5 seconds" 
ExpiresByType image/gif "access plus 5 seconds" 
ExpiresByType image/jpg "access plus 5 seconds" 
ExpiresByType image/png "access plus 5 seconds"  
ExpiresByType application/x-javascript "access plus 5 seconds" 
ExpiresByType text/css "access plus 5 seconds" 
ExpiresByType text/javascript "access plus 5 seconds" 
ExpiresByType image/x-icon "access plus 5 seconds" 
</IfModule>

Edited by almostbob

0

create a .htaccess file in the html_root (exact location depends on your config, wherever your index.php site root is) folder on the thumb drive,
may be all thats required,
(sometimes -not very often- things work easy),
there is minimal documentation on the site, but it appears that ANYTHING, can go in the thumbserver's html root . My AMP test stack is on my server, but I can see myself grabbing a copy of this thing, just to nhave it

Edited by almostbob

0

playing with the USBWebserver, .htaccess works if dropped in F:\USBWebserver v8.5\8.5\root

liking it, very few things WORK straight out of the box, this does

Edited by almostbob

0

I did that, but it's still displaying older version....
.
.
.

I'm not sure if it's the cache that's the problem or my code... :S

What I'm doing is the following:

I have a form.php file that takes in user input (checkboxes and text input).

Whenever the page is being "unloaded" (javascript), the page will submit the form by sending the info to process_script.php. That script will write the info in text files.

After writting, it will redirect the user to the final.php which will pull the info from the text files and display the page. (include() function of PHP)

.
.
.
.

Does any of that seem to be the problem?

Edited by JameB

0

Data Input method: there are more like these but this is the general idea...

<input type="radio" class="check" name="gen_company_name" value="other" <?php $data = file_get_contents("http://localhost:8080/core/data/form_generation/gen_company_name.txt"); if ($data == "other") echo "checked"; ?> />Blank<br/>

then to send the data to the script that saves:

<script type="text/javascript">    
        window.onbeforeunload = confirmBrowseAway;

        function confirmBrowseAway()
        {
            document.forms["gen_form"].submit();
        }

        window.onload = function()
        {
            document.forms[0][0].focus();
        }
    </script>

Then to save the inputted data:

<?php
$sfiles[1] = "gen_signature_third_line_feature.txt";                $sinput_name[1] = "gen_signature_third_line_feature";

    for ($si = 0; $si <= 1; $si++)
    {
        if ($_POST[$sinput_name[$si]] == "yes")
        {
            $data = $_POST[$sinput_name[$si]];
            $file = fopen ($directory.$sfiles[$si], "w");
            fwrite ($file, $data);
            fclose($file);
        }
        else
        {
            $data = "no";
            $file = fopen ($directory.$sfiles[$si], "w");
            fwrite ($file, $data);
            fclose($file);
        }
    }
?>

& finally, to retrieve the data:

<p class="RE">RE:</p>
<p class="subject">
    <?php include($serverdir."edited_gen_re_line1.txt"); ?><br/>
    <?php include($serverdir."edited_gen_re_line2.txt"); ?><br/>
    <?php include($serverdir."edited_gen_re_line3.txt"); ?><br/>
</p>

<br/>

<?php include($serverdir."edited_gen_body.txt"); ?><br/>

Edited by JameB

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.