Wrox Programmer Forums
Go Back   Wrox Programmer Forums > PHP/MySQL > Beginning PHP
|
Beginning PHP Beginning-level PHP discussions. More advanced coders should post to the Pro PHP forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Beginning PHP section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old October 5th, 2004, 03:16 PM
Registered User
 
Join Date: Oct 2004
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default PHP mail() problem...

I have a wierd problem in processing our form mail. The form is located on a page that is launched using a javascript pop-up. Here is the problem...

When the form (that has the mail script) is opened via the java popup() command from the parent page, the form page is sending a "blank" email immediately (before being filled out) and then on submit, it is sending the full email with the form data. It seems that the act of launching the form page is firing the mail() script.

So, how can I stop this from happening? Any ideas? I can't find anything about this online.

 
Old October 6th, 2004, 04:46 AM
Registered User
 
Join Date: Sep 2004
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Why not only send the form if some of the fields are filled in!

post the form info and check for field completed

<form name="form1" <?php echo " ACTION=\"$_SERVER[PHP_SELF]\" METHOD=POST>";?>



If for instance you have a text box named 'email'

 if ($email =="")
               {
                 if(mail($email, $mail_subject, $mail_message, $mail_headers));
               }
else
{
if(mail($email, $mail_subject, $mail_message, $mail_headers));
Ç

Hope this helps



 
Old October 6th, 2004, 04:49 AM
Registered User
 
Join Date: Sep 2004
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Sent answer before i'd finished

Why not only send the form if some of the fields are filled in!

post the form info and check for field completed

<form name="form1" <?php echo " ACTION=\"$_SERVER[PHP_SELF]\" METHOD=POST>";?>



If for instance you have a text box named 'email'

 if ($email =="")
               {
                 echo " please fill in your email address.";
............redisplay form.......
               }
else
{
if(mail($email, $mail_subject, $mail_message, $mail_headers));
}

Hope this helps






Similar Threads
Thread Thread Starter Forum Replies Last Post
Send mail and attachments with PHP mail function Lofa Beginning PHP 1 June 2nd, 2008 03:24 PM
Problem with sending mail in php Paula222 Beginning PHP 4 July 16th, 2006 03:38 PM
flash php mail xeno Flash (all versions) 1 July 9th, 2005 04:45 PM
mail problem in php yertanian PHP How-To 5 January 18th, 2005 10:54 PM
php mail() problem saicon Beginning PHP 2 August 18th, 2003 12:39 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.