Avoid Page Reload Resend - Data Message With It?
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 (Posted: Aug 17 09 at 22:05)
Sponsored Links:
Related Forum Messages:
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?
Posted: Nov 16 10 at 16:41
View 5 Replies!
View Related
$_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'].
Posted: August 23rd, 2010, 01:47 AM
View 9 Replies!
View Related
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.
Posted: May 29, 2010, 09:50
View 7 Replies!
View Related
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();?
Posted: Jul 2 09 at 10:18
View 4 Replies!
View Related
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?
Posted: 12-14-2009, 05:31 AM
View 1 Replies!
View Related
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?
Posted: July 17th, 2005 11:10 AM
View 3 Replies!
View Related
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.
Posted: Mar 22 at 20:38
View 4 Replies!
View Related
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]...
Posted: Jul 1 at 6:27
View 2 Replies!
View Related
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:
Posted: October 17th, 2006, 10:17 AM
View 2 Replies!
View Related
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.
Posted: Oct 28 10 at 20:14
View 1 Replies!
View Related
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?
Posted: Sep 21st, 2010
View 4 Replies!
View Related
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.
Posted: September 7th, 2009, 02:07 AM
View 1 Replies!
View Related
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).
Posted: Mar 11 10 at 15:38
View 2 Replies!
View Related
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?
Posted: May 17 at 22:56
View 2 Replies!
View Related
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.
Posted: May 27 09 at 7:13
View 5 Replies!
View Related
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.
Posted: Jul 14 09 at 1:45
View 3 Replies!
View Related
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.
Posted: July 17th, 2006 04:15 AM
View 10 Replies!
View Related
Automatic Page Refresh Without Reload Of Entire Page?
refreshing a top bar just like facebook where the no of messages are getting updated when the new messages comes just like facebook or gmail without refreshing the whole page . i can do this if that top bar is located externally i can refresh that bar with either meta tag set timeout or with refresh tag , but not getting how to refresh when it is part of main page.how to do this without reloading whole page and without any external file as the full code of the inbox and alert is located in main.php so i cant take it out and call these function externally.
Posted: May 15 at 12:44
View 5 Replies!
View Related
Avoid Overwriting Mysql Data With Dynamically POSTED Data?
This could be PHP or MySql so putting it in PHP forum for now... I have code below (last code listed) which processes a dynamically created Form which could have anywhere from 0 to 6 fields. So I clean all fields whether they were posted or not and then I update the mySQL table. The problem with this code below is that if, say, $cextra was not posted (i.e. it wasnt on the dynamically created form), then this code would enter a blank into the table for $cextra (i.e. if there was already a value in the table for $cextra, it gets overwritten, which is bad). What is the best way to handle this? I'm thinking i have to break my SQL query into a bunch of if/else statements like this... [Code]......
Posted: May 24, 2011, 11:32:45 PM
View 2 Replies!
View Related
Page Reload
I have succesfully created a login page for my site. I have used the PHP_SELF so that once the user has succesfully logged on the page reloads. Everything works fine the first time somebody tries to log in but when they revisit, the log on page is bypassed and it goes straight to the information page. I have a sneaky suspicion that this is due to the fact that the page is then in their history of recently visited sites. How can I use PHP to refresh the page automatically everytime it is requested?
Posted: July 17th, 2005 09:39 AM
View 8 Replies!
View Related
Reload Page On Die
I have a query that seems to fail about one out of five times, resulting in a completely blank page. Here's the query and the call to it (which appears before any HTML is displayed): PHP Code: $query = "SELECT msg.id, msg.to, msg.from, msg.subject, msg.date,   u1.first_name as to_first, u1.last_name as to_last,   u2.first_name as from_first, u2.last_name as from_last FROM messages msg, userprofiles u1, userprofiles u2 WHERE msg.read = 'n' AND u1.id = msg.to   AND u2.id = msg.from AND msg.to = '$userid' ORDER BY msg.date DESC"; $reslt_message = mysql_query($query, $conn) or die(mysql_error()); If there is anything wrong with this query, please let me know. Otherwise, assuming that the query is ok, would it be wrong (or even work at all) to put a header inside the "die" that reloads the page, or would that be bad practice? I can see the possibility of getting an infinite loop, but that could be remedied by adding a variable to the end of the header that would force the code to reload only if it hasn't reloaded yet. if that is clear. When the page crashes, refreshing it works. If I click the link to this page 10 times, it could be the 1st or 10th time that results in a crash, so I'm thinking that the query is ok but it is having trouble processing it or something, which is what led me to think about reloading the page.
Posted: 02-04-2006, 06:35 PM
View 1 Replies!
View Related
Reload Php Page
I am creating (using php) an html page with many links. Clicking on a link open the link as _self. Clicking on the browser back button brings the prv html page (with the links,) but instead of getting it from the cache it will recreate it. how to avoid the re-creation of the php/html page and just to reload it from the cache.
Posted: December 20th, 2005 01:35 AM
View 3 Replies!
View Related
Reload Page
I have a form which is used to add / edit records in a mysql db. This all works fine but after entering a record, and returning to a database view page, a user can hit reload page and a new record is added. Clearly, the previous $_POST vars are still in the system and thus reloading the page runs the same script to add a new record.
Posted: 9:49 pm on Sep. 22, 2005
View 1 Replies!
View Related
Reload This Page
I'm trying to create a cookie on the user's machine that includes the referral url. I then plan to call the data from the cookie in a script that is called on my thank you page to track sales. Why won't the following script work? It's writing "$_SERVER["HTTP_REFERER"]" to the cookie instead of the referrer URL. <?php $value = '.$_SERVER["HTTP_REFERER"].' setcookie("solvotrack", $value, time()+2592000); /* expire in 30 days */ ?>
Posted: 02-27-2006, 05:12 PM
View 3 Replies!
View Related
Form Reload : If User Click The Reload Or Refresh In IE, There Is A Warning Window Popup?
I am writing a very simple code which involve HTML, PHP and Mysql, here is what I have done and the Help I need: the 1st file: index.php PHP Code: <!DOCTYPE html><html lang="en"><head> <title>Testing Site <?php echo $_GET[id];?></title></head><body> <?php if($_GET[id]){ require_once($_GET[id].'.html.php'); }else{ require_once('bb.html.php'); } ?> <?[code].... the DB/table related: I have a DB named mydb in MySQL, which have on table, comments: Code: CREATE TABLE IF NOT EXISTS `comments` ( `user` varchar(30) NOT NULL,[code]... load index.php after you creat the table using above sql..and jump between index.php?id=aa and index.php?id=bb, and u can submit the form and see the comments imm showing after ur submit...it looks great, BUT My problem: if user click the reload or refresh in IE, there is a warning window popup, and remind user not re-submit, but if some user really resubmit, my table will have duplicate record...no change on my entire scripts stucture, means I must use above ?id=$_GET(id) tech to jumping between the aa file and bb file, and I must include both form and insert process in same file, the user expriense should not been impact........ what I need is while user click the reload, no pop window, no duplicate record been insert
Posted: Oct 29, 2009, 02:16
View 14 Replies!
View Related
Reload Form Data
I am developing a web site using php. I have a form for login in page1, which has two input box and a submit button. When I click the submit button in page1, it runs page2. When I click BACK button(now in page1), and FORWARD button (supposed to be in page2). Both IE and Netscape give me a message like the following (note: the browser cache is not turned off either by php header() or by browser setting): ********************************************* This document resulted from a POST operation and has expired from the cache. If you wish you can repost the form data to recreate the document by pressing the reload button. ********************************************* When I press the RELOAD button, page2 is load correctly. Now, how can let the browser automatically do the reload without showing me the above message?
Posted: December 28th, 2000, 03:58 PM
View 1 Replies!
View Related
Page Cache/reload
I have created a facility for users of a site to enter details of property (e.g. location, size etc.). This allows them to upload a picture. Users can also update a picture, adding a new picture to replace an existing one. My problem is that if a user changes/updates the picture and then views the details the old details are displayed unless the user manually clicks refresh. I know that this is because IE is storing the page in cache. I have tried the Meta Tags with "no cache" and "expires" but they don't work. I have also tried to get the page to refresh itself on loading, but it either doesn't work at all or keeps refreshing over and over again. Ideally i would like the page to just refresh once and then stop refreshing but there doesn't appear to be any way of doing this.
Posted: August 1st, 2003, 05:10 AM
View 6 Replies!
View Related
Refresh To Reload The Page
i was using header("Location: http://test.com/alt.php"); on my php page as a refresh to reload the page as i need to refresh the whole page but hold my sessions i set to rest the forms on it. but then i had to create a header redirection page in the website to have get the websites template page on the page i created for the menu logo etc. so turning the original page into a redirection to achieve this. So now my php page is in zen cart and is called in on the first the redirection nut when i try and use a second header location it doesnt work.
Posted: July 29, 2007, 08:02:17 AM
View 2 Replies!
View Related
Page Reload With An <iframe>
Let me to explain the structure.... filename : api.php Having an <iframe src="remotehost/index.php"> </iframe> i have to reload current page api.php after some execution of remotehost/index.php ... I've tried header(); but got formal header error. can we reload current browser url from an iframed code?
Posted: March 13, 2007, 06:28:38 PM
View 3 Replies!
View Related
Does 'Back' Reload The Page?
I notice that when I click the 'Back' button my previous script runs, i.e, all the php code runs (I previously thought that maybe the previous form displays without the code re-running). However, I do not get the expected value displayed on my form. After populating one element in formA with ཌྷ' (just any number) and submitting to formB (using POST ---> Redirect --> GET to avoid the 'expired from cache' message) I then click the 'Back' button and the 17 does not appear. In the code below, after clickng 'Back', I see as output from the echo statement that rb_value[0] is, infact, ཌྷ' but within the form, the text element named rb_value[0] displays as empty. Does anyone have suggestions why this might be? It might have to do with that I do not understand what the 'back' button does. Or maybe with my PRG (post - redirect - get) model. Here is part of the code: echo "rb_value[0]=".$rb_value[0]; //After clicking 'Back' I see that rb_value[0] is 17 if (isset($rb_value[0])) { $rb_val = $rb_value[0]; } else { $rb_val = 1; } $line.= "<td width="20%" valign="center" align="left"> "; // This element displays as empty instead of the expected 17 $line.= "<input type=text name="rb_value[0]" value="$rb_val" size="25" maxlength=25 </center> " $line.= "</td> ";
Posted: 05-14-2007, 07:50 PM
View 5 Replies!
View Related
|