rishiraj Posted July 24, 2007 Share Posted July 24, 2007 I want to submit my from by mail to admin and also store the data in MySQL. here is my form code <form name="form" method="post" action="" onSubmit="return validate2();"> <input type="hidden" name="referer" value="<?=$_SERVER['HTTP_REFERER']?>"> here return validate2() is the function used for form validation and also sends mail to admin by mail() function. After sending mail it directs to thankyou.php where I am using $_POST[""] to store the values in MySQL database. sendmail($txtName,$txtEmail,$toMail,$sub,$message); header("location:process.php"); The problem I am facing is that if I use action="thankyou.php" in form tag then mailsend() don't work maybe because validate2() function is not call. but values are stored after in database going to thankyou.php If i use action="" then thankyou.php is not able to store valur in DB. Please help, suggest if there is any alternative script which can do all the three for from validation, mailing and submitting to database. Link to comment https://forums.phpfreaks.com/topic/61487-solved-form-submit-to-both-mysql-and-by-mail/ Share on other sites More sharing options...
fenway Posted July 30, 2007 Share Posted July 30, 2007 Just have a single script do both jobs. Link to comment https://forums.phpfreaks.com/topic/61487-solved-form-submit-to-both-mysql-and-by-mail/#findComment-311113 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.