Avoid Page Reload Resend - Data Message With It?


Aug 17, 2009

I wrote a simple Contact Us email form (actually a WordPress page-template file). All the code is in one file. After the user submits the form and the email is sent, the file generates a Thank You message. If the user reloads the Thank You page, they are prompted to "Resend the Form Data," which is why I am asking this question.

My question: How do I avoid the prompt to resend the form data and still keep all of my code (including the Thank You data) in one file? EDIT: I've seen folks use headers( Location: ), but I don't think that will work for if I want to keep all my code in one file.

View 4 Replies


ADVERTISEMENT

Avoid The Message 'warning Page Is Expired, Press Refresh Button To Reload?

how to avoid the message 'warning page is expired, press refresh button to reload' when we press back button in php.

View 1 Replies

Caching - Clear Browser Cache To Avoid Form Data Resend After Refresh

I'm developing a PHP-MySQL app that enables registered users to enter text comments. Problem is:

User sign-in into the web site - OKAY
User presented with a form to submit text comment - OKAY
User enters text comment and submits - OKAY

I have a routine that sanitize the comment & save it into MySQL (with userid, textcomment, datetime stamp) & present back the user that his/her comment is entered - OKAY

User decides to refresh browser - a duplicate comment is entered - BAD!

I was thinking 3 options: OPTION 1: Routine that checks: last time user posted comment, and if so, check if this is a duplicate. If duplicate then display error message. OPTION 2: Routine that does not allow a user to post too quickly. So basically do not allow postings of comments within 1 minute or so. So if browser is refreshed the comment will be ignored. OPTION 3: Manipulate the browser cache to clear out its contents so when refreshed no duplicate will be entered.

Now in the context of my application, my concerns with OPTION 1 and OPTION 2 is performance PHP-MySQL since I already have various queries within the same page that push/get data from databases. So OPTION 3 may target the issue differently. Questions is: If I go for OPTION 3 can this be considered a Best Practice?

View 5 Replies

Form Validation :: Reload The Page With Red Error Message

I wrote the following form so that if a user leaves a field blank the page will not process and instead be re-loaded with a red error message asking the user to enter the missing information: Code:

View 1 Replies

$_SESSION['message'] : When I Hit Refresh And Reload The Page The Number Doesn't Increment?

It's working to my favor but I don't trust it unless I know why it's working.Real world example:

I reference $_SESSION['message'] twice in my code.First looks like this:[code]...

Second looks like this:echo $_SESSION['message'];

For some reason, this is working for me and $_SESSION['message'] is getting unset after it's echo'd (but the user remains logged in so I know the entire session is not getting unset).

Test example: I put the following code in test.php:
<?php
session_start();
$_SESSION['message']++;
echo $_SESSION['message'];
?>

When I hit refresh, reload the page, etc. the number doesn't increment, it's stays as '1'. If I change it to $_SESSION['success_message'] the number does increment.So? Is $_SESSION['message'] reserved? Does it automatically reset once it's echo'd? I didn't find anything in the manual on this.

UPDATE:I just checked in Firefox and test.php works as expected. In Chrome it doesn't. Chrome does so many wacky things, I wouldn't be surprised if it's resetting $_SESSION['message'].

View 9 Replies

Reload Page Without Form Data

As the title says im posting some form data to another php file that processes it. I then want to return to the orig. form to start over but the same data is still in the form. Whats the best way to go about making the form fresh.

View 7 Replies

Javascript - Reload Page Without Posting Data?

I'm trying to refresh a page without sending POST from the previous time.

I've tried

window.open("postme.php?r=t","_self");

Which appends a ?r=t to the end but it doesn't appear to refresh the page as the page displays a number of file s in a directory which hasn't change even though I have moved or deleted them.

Can you specify the URL in window.location.reload();?

View 4 Replies

Using A Button To Set Session Data And Reload Page

I'm trying to design a page that will show information based on selections made by the user. For example;

I'm logged in so the page shows me all the leagues that I play in as a series of forms which just show one button each. These forms submit the variable for the league name - so far so good.

I can set the action for these forms as 'somefile.php' and assign the $_POST[league] to the $_SESSION and echo this value, so I know that the data is being passed correctly by the form.

What i want to do though is set the form action to something that will allow me to reload the same page, now with the $_SESSION['league'] variable set and as a result show the games within that league. So each time a player presses teh button for a new league the relevant games are shown.

I've tried to set the form handler to redirect back to the page using header() but it doesn't seem to pass the $_SESSION['league'] variable back so the function for checking if the league is set fails?

View 1 Replies

Preventing Multiple Data Insertion On Page Reload

I am developing a PHP-mysql database. It is noted that when the
browser window is refreshed the data is inserted again in the
database. unfortunately there is no unique keys that I can use to
verify the existance of the data, so as to prevent the multiple
insertion. Is there any other way to prevent it otherthan introducing
another field for this purpose and verifying its existance?

View 3 Replies

Posting Data To The Server, Without Causing The Page To Reload?

I'm building a website which has a page that users can add content to, and they can rearrange the divs to whichever position and size they want. I'd like to have a save button which saves the current position of each div; however, I don't want the page to refresh each time (I'm also going to have an auto-save, which will have to save the information in the background).

I can't figure out how to post the data to the server though, without causing the page to reload. I figure I need some kind of AJAX request, but can't find anything that tells me how to do that (all the AJAX examples I can find seem to be about reading data from the server). I think I'm just starting to go round in circles now, but I can't get my head around this at all - I know it's probably not a hard thing to do, but I keep getting confused by the different examples.

So, first of all, is this the best way to do it? And, if so, can someone point me to a straightforward example of posting data via AJAX? I'm already using jQuery, so can use that for the Ajax as well.

View 4 Replies

Jqgrid:data Failed To Change After Reload Page?

I have some grid which use form edit. But after edit success then page reload the data in grid back to the beginning. Its mean that edit process is failed.I have confused how to post this all variable into process page, because i'm use switch-case for this php page. I put some hidden action inside the form:jqgrid script.

<form id="editdefdata" class="editable">
<input id="action" name="action" value="changedefdata" type="hidden" />
<button id="defupdate"><span>Update </span></button>

[code]...

View 2 Replies

Can Header() Do A Div Reload Without A Page Reload (ie Ajax-type)?

I have a display page (displaypage.php) divided into two panes - one for content and one for feedback, referred to in the CSS as contentDiv and feedbackDiv respectively.

When I click on a word in the content pane, I do a PHP/PostgreSQL search for similar words, and the results appear in the feedback pane without a page reload. For this, I am using a very basic Ajax setup Code:

View 2 Replies

Ajax Or JQuery Page Reload With New Data Added To Sql Database

I have a PHP page which currently refreshes every 2 minutes because it has to check for new data in the sql database. It's pretty annoying if you're using it and it keeps refreshing. The database is updated about 3 times a day, but what is shown on that page needs to be kept current with what's in the database. I'm trying to find a way to have ajax or something check the database every 30 seconds or so, and if there is something new, then refresh, but if there isn't anything new don't refresh.

Does anyone know of any tutorials out there, or something that can get me started? I have the concept down I think... I just can't figure out the code. I'm sure if I get it to check the database I can figure out the rest.

View 1 Replies

Contents Of Page Reload When Any User Post Data In Database

I have developing messenger in php. In my application in need to reload the content of div in a page while any user post their comments on database of server.

View 2 Replies

Resend Values To Other Page Using It

I have some problem posting data to other page. Now i am explain. One page (called A.php) is refershing and checking database whether status 1 or 0. If sataus finds 1, A.php page posting values to B.php automatically. Then i need to confim whether B.php page getting values or not from A.php. Suppose If B.php page did not get the values from A.php, I need to resend once again to B.php page.

So the problem is , once i sent the values first time from A.php to B.php, as we know suddenly A.php page has gone and display B.php. I can not resend once again from A.php. How we can send Once again from A.php to B.php?

View 4 Replies

Value Preserving Across Multiple Pages / Reload The Original Page With Posted Data?

i am trying to post the some data on another page at this i have a back button onclick of back button i wanna reload the original page with posted data.

View 2 Replies

Resend Hidden Variables Again On Same Page?

i am login in php file then on 2 php file i am checking values which i sending user name from 1st php file to 2nd . main problem is i am refreshing 2nd php file after each 4 min, but it not resending values, so how i said on 2nd page i am checking with database. if it not match with values then reload same page as invalid user name and password.

View 1 Replies

HTTP - Cache RSS Data To Avoid Requesting It Everytime The Page Loads?

I'm parsing data from this RSS feed: [URL] The data there updates once every hour. To parse it, I load the RSS at the initialization of my class and convert it into an usable object. The problem with this is that every time the page loads, the RSS is parsed again, and the HTTP request delays the page loading. I was thinking of a cronjob to parse the RSS hourly, and then save the data in a JSON structure. But I'd really like to not depend on the cron, as not all shared hosting servers provide it (although they should).

View 2 Replies

Not Give Error When Resend After Sending Something + Refreshing The Page

making it not say resend after sending something + refreshing the page

View 3 Replies

Avoid The Getimage() Warning Message?

Recently i worked in project. there i need to a resize a picture and i use the following class.

class SimpleImage
{
var $image;
[code]....

View 2 Replies

Check If Dir Exists Avoid Error Message?

I think I have missed something with the code below... Maybe you can help

<?php
$imageurl = $pagename1;
$imageurl = preg_replace('/.asp/', ''.$g_sites_img2.'.jpg', $pagename1);
$filename = $_SERVER{'DOCUMENT_ROOT'}.'/images'.$imageurl;
if (file_exists($filename)) {
echo '<img src="'.$mainurl.'/images'.$imageurl.'" width="'.$g_sites_img2.'" align="left" />';
} else {
$imgremoteurl = $imgremoteurl.str_replace(' ', '_', strtolower($g_page_identify));
$imageurlfolder = dirname($pagename1);............

If I refresh the page, the error message disappears when the file is created. How can I write the script so that it checks the folder, if it exists it does not throw the error?

View 2 Replies

Error Handling - Avoid Warning Message?

Recently i worked in project. there i need to a rename a picture. the problem is when i rename the picture it renamed but show a warning message like bellowWarning: rename(seeker/SeekerPhoto/katr.jpg,seeker/SeekerPhoto/ussl.jpg) [function.rename]: No such file or directory in /subdomains/www/html/ussl/job/insphoto.php on line 100 how can i avoid this warning message. that mean whatever the warning was it will go for next task.

View 5 Replies

Avoid Dead Message In Comet Chat?

I am doing Comet chat with Erlang and PHP. But now I think I met a problem: the polling connection will disconnect and reconnect automatically in about a certain time (I set this with 10 seconds), so there will be a period of time that the user doesn't connect to chat server. If a user send message at that time, the message will be dead (no one could receive it). In the client code I am using jquery with jsonp to realize the polling connection.

View 3 Replies

Error Message - Avoid Notice In When One Of The Conditions Is Not True?

I've notice that when one of the two conditions in a php if statement is not true. You get an undefined index notice for the statement that is not true. And the result in my case is a distorted web page.
For example, this code:

<?php
session_start();
if (!isset($_SESSION['loginAdmin']) && ($_SESSION['loginAdmin'] != '')) {

[code]...

View 8 Replies

How To Refresh Page Without Prompt The "resend Information...."?

I wrote a PHP page for user input the information to search the
database. And the database data will update every second. I want to
set the auto refresh to get the data from database every minute. But
the page always display the dialog box ask me to resend the
information. How to disable this warning message. I using POST and
REQUEST to get the data from user input page.

View 10 Replies

Session Var Is Setting ONLY AFTER I Reload Page, Form Var Displays First Page Load

Page1 has a form that calls Page2. The beginning of Page2:
<? php session_start();
$s=$_POST['sSelected'];
session_register("s"); ?>

in the middle of Page2 I have a form varaible:
<?php echo $_POST['stateSelected']; ?>
<?php echo $_SESSION['s']; ?>

The form var displays the first time the page loads. The session var
displays only after reloading the page2.

View 3 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved