473,386 Members | 1,764 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

stop resending data when click refresh

29
I have a contact form that send goes tru this validation page if everything corrct this php page will echo the form sumited succefully but the problem is evrytime the user clicks submit the data gets resend how can i stop the user frm doing that
Expand|Select|Wrap|Line Numbers
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  2.  
  3. <html>
  4. <head>
  5. <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  6. <title>Sendemail Script</title>
  7. </head>
  8. <body>
  9.  
  10. <!-- Reminder: Add the link for the 'next page' (at the bottom) -->
  11. <!-- Reminder: Change 'YourEmail' to Your real email -->
  12.  
  13.  
  14. <?php
  15.  
  16.  
  17.  
  18. $ip = $_POST['ip'];
  19. $httpref = $_POST['httpref'];
  20. $httpagent = $_POST['httpagent'];
  21. $visitor = $_POST['visitor'];
  22. $visitormail = $_POST['visitormail'];
  23. $notes = $_POST['notes'];
  24. $attn = $_POST['attn'];
  25.  
  26.  
  27.  
  28.  
  29.  
  30. if (eregi('http:', $notes)) {
  31. die ("Do NOT try that! ! ");
  32. }
  33. if(!$visitormail == "" && (!strstr($visitormail,"@") || !strstr($visitormail,".")))
  34. {
  35. echo "<h2>Use Back - Enter valid e-mail</h2>\n";
  36. $badinput = "<h2>Feedback was NOT submitted</h2>\n";
  37. echo $badinput;
  38. die ("Go back! ! ");
  39. }
  40.  
  41. if(empty($visitor) || empty($visitormail) || empty($notes )) {
  42. echo "<h2>Use Back - fill in all fields</h2>\n";
  43. die ("Use back! ! ");
  44.  
  45.  
  46. }
  47.  
  48.  
  49.  
  50. $todayis = date("l, F j, Y, g:i a") ;
  51.  
  52. $attn = $attn ;
  53. $subject = $attn;
  54.  
  55. $notes = stripcslashes($notes);
  56.  
  57. $message = " $todayis [EST] \n
  58. Attention: $attn \n
  59. Message: $notes \n
  60. From: $visitor ($visitormail)\n
  61. Additional Info : IP = $ip \n
  62. Browser Info: $httpagent \n
  63. Referral : $httpref \n
  64. ";
  65.  
  66. $from = "From: $visitormail\r\n";
  67.  
  68.  
  69. mail("youremail@yahoo.co.uk", $subject, $message, $from);
  70.  
  71. ?>
  72.  
  73. <p align="center">
  74. Date: <?php echo $todayis ?>
  75. <br />
  76. Thank You : <?php echo $visitor ?> ( <?php echo $visitormail ?> )
  77. <br />
  78.  
  79. Attention: <?php echo $attn ?>
  80. <br />
  81. Message:<br />
  82. <?php $notesout = str_replace("\r", "<br/>", $notes);
  83. echo $notesout; ?>
  84. <br />
  85. <?php echo $ip ?>
  86.  
  87. <br /><br />
  88. <a href="contact.php"> Next Page </a>
  89. </p>
  90.  
  91.  
  92.  
  93. </body>
  94. </html>
May 14 '10 #1
2 4409
dlite922
1,584 Expert 1GB
I don't see your submit button on the page above, which I think is your result page.

Can't you just hide the submit form? or just forward to a different page?

Is that what you're asking?





dan
May 14 '10 #2
lisa007
29
that was just the php validation the actual form is on a different page which is this one basicaly this is the form and the other is the validation php wich include the email.

Expand|Select|Wrap|Line Numbers
  1. !DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  2.  
  3. <html>
  4. <head>
  5. <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  6. <title>Email Form </title>
  7. </head>
  8. <body>
  9.  
  10. <form method="post" action="sendeail.php">
  11.  
  12. <!-- DO NOT change ANY of the php sections -->
  13. <?php
  14. $ipi = getenv("REMOTE_ADDR");
  15. $httprefi = getenv ("HTTP_REFERER");
  16. $httpagenti = getenv ("HTTP_USER_AGENT");
  17. ?>
  18.  
  19. <input type="hidden" name="ip" value="<?php echo $ipi ?>" />
  20. <input type="hidden" name="httpref" value="<?php echo $httprefi ?>" />
  21. <input type="hidden" name="httpagent" value="<?php echo $httpagenti ?>" />
  22.  
  23.  
  24. Your Name: <br />
  25. <input type="text" name="visitor" size="35" />
  26. <br />
  27. Your Email:<br />
  28. <input type="text" name="visitormail" size="35" />
  29. <br /> <br />
  30. <br />
  31. Attention:<br />
  32. <select name="attn" size="1">
  33. <option value=" Sales n Billing ">Sales n Billing </option>
  34. <option value=" General Support ">General Support </option>
  35. <option value=" Technical Support ">Technical Support </option>
  36. <option value=" Webmaster ">Webmaster </option>
  37. </select>
  38. <br /><br />
  39. Mail Message:
  40. <br />
  41. <textarea name="notes" rows="4" cols="40"></textarea>
  42. <br />
  43. <input type="submit" value="Send Mail" />
  44. <br />
  45. </form>
  46.  
  47. </body>
  48. </html>
May 14 '10 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

11
by: brendan | last post by:
Sorry this isnt a cross post .. i just didnt get any help from alt.php. I have a website which utilises post forms for navigation in some areas. Problem is, when *some* users hit the BACK button...
2
by: Roy Scarisbrick | last post by:
I have a programming issue on an ASP.Net web page. I suspect the issue would apply to any version of ASP though. I have a questionnaire page where a user will answer a bunch of questions with...
3
by: Sameer | last post by:
I have a webpage that has a link button. This link button on click opens up a new page. This is what is happening: 1. Load the web page. 2. Click on the link. 3. Refresh the web-page. Result:...
5
by: antonyliu2002 | last post by:
I have 4 forms each on a separate page respectively form1.aspx, form2.aspx, form3.aspx, form4.aspx. On top of each of the four pages there are 4 links which link to the aforementioned 4 pages...
15
by: tmax | last post by:
PHP Pros: I have a simple html form that submits data to a php script, which processes it, and then redisplays the same page, but with a "thank you" message in place of the html form. This is...
5
by: =?Utf-8?B?YzY3NjIyOA==?= | last post by:
Hi all, Recently, I just found out that our program behaves differently from before. in our asp, in order to prevent data disppearing problem in form fields,we use session variable to display...
2
by: pauland80 | last post by:
Hello, My soft passively listen to a device sending +- 300 bytes of data each second. After several hours of work, the soft abruptly stops receiving data without any error, (while the device...
9
by: Navaneet | last post by:
Hi, Can anyone tell me how to prevent some particular POST DATA when refresh button (F5) clicked on server side(vb.net). Thanks Kumar N
3
by: simonyong | last post by:
Im a newbie to asp.net, i hav a bit dilemma when thinking about how i should let it work.. My task as below: My task is related to view all data from a table called "employee " i had create a...
1
by: elriez | last post by:
hye all currently im doing a project that need to include the sound..i already include the sound by simply import to the library and drag it to the stage..the sound can play well..the problem...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.