I'm using Zen Photo's built in contact form. Currently the form is placed in a div that's initial state is hidden. A visitor to the site can click a link that makes the div visible and they can enter their data. That all works just fine. The problem comes in when the form is submitted. The div hides itself again. If you click the link that makes the div visible the contact form is performing as it should, asking the user to confirm their submission.
I know the problem is caused by the page reloading and setting the div back to it's original state. I've tried using a postback function, but I'm afraid that may strictly be an ASP command and not suitable for the php form. Does anyone have any suggestions to tell the page "if you reloaded because of a form submit, make this div visible"?
Thanks
Comments
So I would guess that you are using something else. Anyway, don't put the form in a hidden DIV if you want it to show.
Normally you would create a separate page for the contact form and link to it from wherever you wish on your other pages.
So far, based off of acrylian's suggestion I've come up with this:
`
function postback() {
if(isset($_POST['sendmail'])) {
document.getElementById('inquiry').style.visibility = 'visible';
}
else {
if (document.layers) { // Netscape 4
document.inquiry.visibility = 'visible';
}
else { // IE 4
document.all.inquiry.style.visibility = 'visible';
}
}
}
`
But, so far I haven't had any luck. Is PHP not capable of telling a div to become visible if it is returning data from a form? Am I close to solving it with what I've written?
`
`
Any idea why there is a lag in receiving the emails and other times they just come right through? I'm guessing it's a hosting issue (using GoDaddy). Or maybe my email provider (Gmail)
Thanks again for your help!
Update: I did a new test on my host and it worked fine.