Digital Point Forums
San Diego Models

Go Back   Digital Point Forums > Design & Development > Programming > PHP
Google Analytics
Log In to view
your analytics

Reply
 
Thread Tools
  #1  
Old May 9th 2008, 2:53 am
dean5000v dean5000v is offline
Champion of the Naaru
 
Join Date: Dec 2007
Posts: 183
dean5000v is an unknown quantity at this point
PHP form

ok ive done a simple form which posts to
<?php echo $_SERVER['PHP_SELF'];?>">

ok when the page gets refreshed after the submit button has been pressed it then resends the data again, how can i stop it from resending the data once the page is resent ??
Reply With Quote
  #2  
Old May 9th 2008, 3:20 am
Amilo Amilo is offline
Twilight Vanquisher
 
Join Date: Jan 2006
Posts: 624
Amilo is on a distinguished road
Have a look here and see if it helps you.
__________________
Beekeeping Forum
Reply With Quote
  #3  
Old May 9th 2008, 4:08 am
dean5000v dean5000v is offline
Champion of the Naaru
 
Join Date: Dec 2007
Posts: 183
dean5000v is an unknown quantity at this point
ermm didnt see anything in there that wld help, i just wnt it so if the page is refreshed the data doesnt get resent.
Reply With Quote
  #4  
Old May 9th 2008, 4:35 am
blueparukia's Avatar
blueparukia blueparukia is offline
of the Nightfall
 
Join Date: Jul 2007
Posts: 1,358
blueparukia has a spectacular aura aboutblueparukia has a spectacular aura aboutblueparukia has a spectacular aura about
So the data is from the form? In the form, add a hidden input:

Code:
<input type="hidden" name="dataResend" />
For PHP

php Code:
<?
if{!ISSET($_POST['dataResend'])){

//Add code here for when the page is refreshed

}
else{

//Add Code here for when the form is sent.
//Refresh the page, clearing all data:
header("Location: ".$_SERVER['PHP_SELF']."");

}
?>
__________________
The Atheist Blogger|Free Movies||
Reply With Quote
  #5  
Old May 9th 2008, 4:45 am
tamilsoft tamilsoft is offline
Banned
 
Join Date: Apr 2007
Location: Need Wordpress Plugin?, contact me
Posts: 1,158
tamilsoft is a jewel in the roughtamilsoft is a jewel in the roughtamilsoft is a jewel in the rough
Check with this code:

php Code:
<?php
if(isset($_POST['resend']) && $_POST['resend'] == $_COOKIE['resendvalue'])
{
echo 'do insert';
setcookie('resendvalue','',time()-1000,'/');
}
$resendval = time();
setcookie('resendvalue',$resendval,time()+1000,'/');
?>
html4strict Code:
<form method="post">
<input type="text" name="mytest">
<input type="submit" value="ok">
<input type="hidden" name="resend" value="<?php echo $resendval;?>">
</form>
Reply With Quote
Reply

Bookmarks

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
I have a html form, you need to make a sendmail.php to preocess my form sakib000 Programming 6 Mar 20th 2008 5:28 am
Frontpage Form needs to be converted to .php form gariben Programming 8 Mar 9th 2008 12:20 pm
PHP Tutorial: Writing Your First PHP Script: Feedback Form Script Jerlene.net Freebies 0 Jul 8th 2007 2:55 pm
PHP Contact Form / Order Form Service metalstein Services 0 Jan 1st 2007 1:10 pm
php and form wormser PHP 4 Oct 5th 2006 7:26 am


All times are GMT -8. The time now is 9:51 pm.