CodeCharge Studio
search Register Login  

Web Reporting

Visually create Web Reports in PHP, ASP, .NET, Java, Perl and ColdFusion.
CodeCharge.com

YesSoftware Forums -> Archive -> GotoCode Archive

 formhandler sends mail twice

Print topic Send  topic

Author Message
RonB
Posted: 05/06/2003, 10:48 AM

Oke, got some small bit of code to handle forms. It get's the form value's so it works. It just sends the form twice via email. So it works a little to good. :-)

Haven't got a clue what is causing this somewhat overenthousiastic behaviour. Any suggestions? Here's the code:

<?php

$delimiter = $HTTP_POST_VARS["delimiter"];
$mailto = $HTTP_POST_VARS["mailto"];
$returnhtml = $HTTP_POST_VARS["return"];
$subject = $HTTP_POST_VARS["subject"];

for($x=0;$x<sizeof($HTTP_POST_VARS);$x++)
{
$name = key($HTTP_POST_VARS);
$value = current($HTTP_POST_VARS);
if($name != "mailto" && $name != "return" && $name != "subject" && $name != "delimiter")
{
if(is_array($value))
{
foreach($value as $value_arry)
{
$mailtext .= "$name$delimiter$value_arry\n";
}
}
else
$mailtext .= "$name$delimiter$value\n";
}
next($HTTP_POST_VARS);
}

$mailtext = stripslashes($mailtext);
$mailtext = chop($mailtext);

mail($mailto,$subject,$mailtext);

header("Location: $returnhtml");

?>


Help??!!
RonB
Posted: 05/07/2003, 2:24 PM

help???
TimY
Posted: 05/09/2003, 10:12 AM

Hey,

I don't have a quick answer.

Here's a couple things to check.
What happens if you take out the header instruction?
I'm wondering if there's something in the page that's posting to this one that's causing it to send it twice.
also...
What does the $mailto variable look like?

Tim
RonB
Posted: 05/10/2003, 7:13 AM

the header returns the user to the index page and there's nothing on that page that could trigger a second submit. removing it has no effect on the result the form returns two emails with unique Identifiers.

The mailto variable just holds an email adres(someone@someadres.com)

Ron
GreggB
Posted: 05/10/2003, 8:54 AM

Ron,

I thought I had the same problem once and found that it was the way I had the project’s mailbox setup and Outlook Express.

I had my project mail account set to forward all mail to my personal account and my Outlook Express setup to receive all email from the project account and my personal account. Thus 2 email showed up in Outlook Express. I did this to monitor the project and make sure the mail was being generated ok. Hmmm, could this be a privacy issue… Anyway I think this was the way I had it setup. Once I stopped the forwarding the problem was resloved.

OK, this may not be your problem and if it’s not, don’t laugh to hard ; )

GreggB
RonB
Posted: 05/10/2003, 2:55 PM

I wouldn't dare laught at you, I make to much mistakes because I overlook the simple solution and get all complex myself. I didn't use forwarding and I can see the email message identifiers are different. It's not a problem of getting the same email twice. The email is actualy being send twice and has two unique identifiers.

Ron
feha
Posted: 05/11/2003, 6:29 AM

Please check your events
after insert event (place e-mail code in differnt events just to check) it may comeback and execute sending e-mail twice
(if you have any JavaScript too ...)




regards
feha
[www.vision.to]
RonB
Posted: 05/11/2003, 9:22 AM

the script is not part of CCS it's a standalone php page and all it does is get a form and send it via email. I need it for a client that wants to be able to construct new forms from her website. So I need a universal formhandler to email the form. Normally that would be less of a hassle then creating code in CCS that let's a user make a form and store it in the database. I do not want to have to do a lot of maintainance just to create forms for her. I have a form template with all the hidden fields and the submit button. All the client has to do is finish the form in htmlarea and it will be available on the web page.

Ron
TimY
Posted: 05/12/2003, 12:05 PM

Hi Ron,

Curious. So are you convinced its the php code or is something wrong with the mail server? Have you used the mail command succesfully in other ways? Just trying to think of ways to pinpoint the problem.

Tim
RonB
Posted: 05/13/2003, 6:41 AM

Yep, I tried the mail function in phpEdit and it returned just the single mail. I'm getting pretty stumped here.

Maybe the fact that the form is being retrieved from the database and inserted in a regular php page generated by CCS could be the problem. I'll try and see what happens if I use the mailhandler on another account.



Ron

   


These are Community Forums for users to exchange information.
If you would like to obtain technical product help please visit http://support.yessoftware.com.

PHP Reports

Visually create Web Reports in PHP, ASP, .NET, Java, Perl and ColdFusion.
CodeCharge.com

Home   |    Search   |    Members   |    Register   |    Login


Powered by UltraApps Forum created with CodeCharge Studio
Copyright © 2003-2004 by UltraApps.com  and YesSoftware, Inc.