Re: [PHP] script executeion problem - executes twice for no reason - help

2002-04-22 Thread R'twick Niceorgaw

remove the To:$email  from $headers. You have it already in the $to
parameter.


- Original Message -
From: Edward Bailey [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Monday, April 22, 2002 11:48 AM
Subject: [PHP] script executeion problem - executes twice for no reason -
help


 Please excuse my ignorance, this is probably a simple
 problem but I have no idea what to do next.

 I wrote the following to send an automated response to
 users that fill out a form, select submit and that
 triggers the conditional if statement and then the
 script sends an HTML based newsletter to the user. The
 script does work, but it sends out TWO newsletters
 instead of one and I have no idea why. I have used the
 code below in several different forms and it does the
 same thing each time so I would assume the code is the
 problem.


 if()
 {$filename = ../includes/news.html;
 $to = $email;
 $subject = Newsletter;
 $fd = fopen ($filename, 'r');
 $message = fread ($fd,
 fileSize(../includes/news.html));
 fclose ($fd);
 $headers = To: $email\nFrom: $from\nReply-To:
 $reply_address\nMIME-Version: 1.0\nContent-type:
 text/html; charset=iso-8859-1\n;
 mail($to, $subject, $message, $headers);
 }

 Can anyone help me or point me in the right direction?

 Thanks

 Ed


 __
 Do You Yahoo!?
 Yahoo! Games - play chess, backgammon, pool and more
 http://games.yahoo.com/

 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php






-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] script executeion problem - executes twice for no reason- help

2002-04-22 Thread Miguel Cruz

On Mon, 22 Apr 2002, Edward Bailey wrote:
 if()
 {$filename = ../includes/news.html;

This condition will always return true.

What you are doing here is first executing the assignment:

   $filename = ../includes/news.html;

and then testing the outcome of that assignment (which is 
../includes/news.html). 

If you want to test whether or not $filename contains 
../includes/news.html, then you should use == instead of =

miguel


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php