Jump to content

[SOLVED] Form submit to both MySQL and by mail


rishiraj

Recommended Posts

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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.