Multiple Form Submissions
Permalink
Hi there - I have several form blocks in a site. I process the form post in index.php so I can send an email to the proper person, depending on which form was submitted.
This works fine, except the people are getting 2 and sometimes up to 5 emails with the same form data. Seems to me C5 must be caching the post data and submitting every time they go to a new page - since they all go through index.
Does this make any sense to anyone and how can I fix?
This works fine, except the people are getting 2 and sometimes up to 5 emails with the same form data. Seems to me C5 must be caching the post data and submitting every time they go to a new page - since they all go through index.
Does this make any sense to anyone and how can I fix?
So you have multiple form blocks on the same page? Or you have custom code that's notifying people when a form block is submitted? Or you are not using the form block and just have your own forms? I need some clarification in order to help.
Hi - thanks for replying. I have four different forms, on four different pages, all using the standard form block. The form post(s) are processed within index.php. Depending on which form is posted, I create a text message with the data and email it to the appropriate person.
That works great - the problem is that multiple emails are being sent - even though the user has not submitted the form multiple times. Seems C5 is caching the post data, and anytime index.php is hit, the data is resubmitted. Though I'm not sure of that, I just don't know how else the data is being sent so many times.
That works great - the problem is that multiple emails are being sent - even though the user has not submitted the form multiple times. Seems C5 is caching the post data, and anytime index.php is hit, the data is resubmitted. Though I'm not sure of that, I just don't know how else the data is being sent so many times.
I don't know what you mean when you say "the forms are processed by index.php". Can you please explain this in more detail?
I mean, I have code in index.php that catches the form post, formats it, and sends an email to the proper person.
Here's a bit of the code I have:
//check to see if a form was submitted
if(isset($_POST['pURI'])){
$fName = $_POST['pURI'];
if(strpos($fName,'general-inquiries') !== false){
$sub = "General Inquiry";
$tomail = "contactus@vicibeautyschool.com";
$message .= "First Name: ".$_POST['Question1'].$d;
etc.
Here's a bit of the code I have:
//check to see if a form was submitted
if(isset($_POST['pURI'])){
$fName = $_POST['pURI'];
if(strpos($fName,'general-inquiries') !== false){
$sub = "General Inquiry";
$tomail = "contactus@vicibeautyschool.com";
$message .= "First Name: ".$_POST['Question1'].$d;
etc.
So you've modified Concrete5's index.php file? This is a very bad way to accomplish this for many reason (it might mess up system functionality, it will disappear as soon as you upgrade the system, it will be hard for other developers to figure out the code if they need to come in and maintain the site, etc.).
Why aren't you just using the built-in email notification functionality of the form blocks themselves? I don't see what your custom functionality is doing that the built-in functionality can't handle itself.
Why aren't you just using the built-in email notification functionality of the form blocks themselves? I don't see what your custom functionality is doing that the built-in functionality can't handle itself.
I did what I did because I didn't really know what I was doing. :)
I will have a look at using the built-in email functionality then - when I built the forms I didn't realize there was an email option so did the index thing...
Thanks for straightening me out!
I will have a look at using the built-in email functionality then - when I built the forms I didn't realize there was an email option so did the index thing...
Thanks for straightening me out!
Wait one sec - does the built-in, notify me by email when someone submits the form - actually send the form data? If not then this is of no use to me - I need to be able to send the captured form data in the email.
I think it does, but I don't remember 100%. Just test it out and see (add it to a hidden page of your site if the site is already live).
I can't test is the problem - the client has email configured so it won't come out of the building... so only they can see emails from the site. I will just give it a try. Thanks much Jordan.