Forum Moderators: coopster
I have a PHP form that I've developed over the past couple of years - it works very well. Even though I've developed this on my own - I did it through a ton of trial and error, and a lot of luck. In all honesty, if you asked me what each line of the code did, I'd say "It works, doesn't it?" - I couldn't really tell you what it does at all - except work. So I am, by no menas, a guru at PHP - I just "got" things as I went along and finally made this thing work.
The form usually takes two files - an HTML file (which holds the layout of the page and form) and the PHP file, which is what's called into the browser and makes the form function.
Well, for *this* website, I have to have the HTML and PHP files combined into one file. I finally achieved success with that. I needed an alert box to pop up when the user clicked "Submit" - fine. it works.
My problem is that, on my old system, the page would redirect to a "Thank you" page - but this time, I can't do that. I have to have the form stationary on the page, and it can't redirect to anywhere else - when the form is submitted, that's it.
What I *want* is some type of script or *something* that will clear the form when the "Submit" button is clicked. I've tried many things to get this to work - I've only had *one* success (by using a version of "javascript:document.contact.reset();") - the problem with that was that it would clear the form *before* submission, so nothing would be sent at all. (I also had slight success with a version of if ((isset$_POST something or other) - but that cleared the whole *page* and made it blank.
I'm at a loss. I can't believe this is so hard to do - or to find information on. Surely someone out there can help me find a solution to this problem? Having pop up windows or alternate versions is not an option, unfortunately - I've already run that by my client, and they're adamant about having this on one page, and one page only, no redirects.
I'd really appreciate any help you all could offer! Thanks!
[edited by: ergophobe at 3:58 pm (utc) on May 19, 2005]
[edit reason] code dump snipped - not needed - see forum charter [/edit]
<?php
if(!isset($_POST))
{
//do the form
}
else
{
//read the submitted form
echo "Thank you<br><a href="#">To send another form go here.</a>";
}?>
Certainly you may put whatever you like. And you won't have to clear the form, because you won't have it.
Hope this is of some value to you
Michal Cibor