Jump to content

Require Two Events from Form Submission


Aldark

Recommended Posts

I have a question.  I have a form that I am storing submitted referrals in MySQL; at the same time I need to email the values to my client.

 

I can do both individually, but cannot wrap my head around combining them into one action.

 

This is my insert code and I want those values passed through to email.

$sql = "INSERT INTO tbl_referral (
		fname,
		lname,
		phone,
		phonetype,
		email
		$addl_insert_crit ) valueS ( '$fname',
		'$lname',
		'$phone',
		'$phonetype',
		'$email'
		$addl_insert_values )";
if ($sql_debug_mode==1) { echo "<BR>SQL: $sql<BR>"; }
$result = mysql_query($sql,db());

 

Any thoughts or ideas would be great.

 

Thanks

Link to comment
https://forums.phpfreaks.com/topic/122173-require-two-events-from-form-submission/
Share on other sites

Simply add the code to send the email after the code to insert the record into the database (or vice versa).

 

//Insert into database
$sql = "INSERT INTO tbl_referral
        (fname, lname, phone, phonetype, email $addl_insert_crit)
        VALUES
        ( '$fname', '$lname', '$phone', '$phonetype', '$email' $addl_insert_values )";
if ($sql_debug_mode==1) { echo "<BR>SQL: $sql<BR>"; }
$result = mysql_query($sql,db());

//Send email

//....Code for email goes here

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.