i am working on a form that uses a mail() function to email, but when the page is clicked, it send a blank email. how can i stop it until submit button is clicked?
| SitePoint Sponsor |
Check if the form has been sent.
Guido - Community Team Advisor
Do you know where the (database) error is? Add it to the list!
Thinking Web: Voices of the Community
Blog - Free Flash Slideshow Widget
Assuming that your form's method='post'. If it's 'get', then use $_GET['formfieldname']PHP Code:if (isset($_POST['formfieldname'])) {
}
Guido - Community Team Advisor
Do you know where the (database) error is? Add it to the list!
Thinking Web: Voices of the Community
Blog - Free Flash Slideshow Widget
right now i am using
within those curly bracket i m settling the field name into variable. so wht should i do to change it?Code PHP:if(isset($_POST['submit'])){ }
Can you post the entire script (without database login data)?
Guido - Community Team Advisor
Do you know where the (database) error is? Add it to the list!
Thinking Web: Voices of the Community
Blog - Free Flash Slideshow Widget
here it is
Code PHP:<?php if(isset($_POST['submit'])){ $refBy = "<p>"."Refered By :" .$_POST['referrer']."</p>"; $comp = "<p>"."Company :" .$_POST['company']."</p>"; if(isset($_POST['checko'])){ $opt = implode("<br>",$_POST['checko']); }else{ echo ""; } } if(isset($_POST['payment'])) { $payMod = implode("<br>", $_POST['payment']); } ?>
You'll have to put the mail() command inside that if as well. You want to send a mail only when the form has been submitted.
Guido - Community Team Advisor
Do you know where the (database) error is? Add it to the list!
Thinking Web: Voices of the Community
Blog - Free Flash Slideshow Widget
Bookmarks