help contact form improvement

the mail() function

Moderators: macek, egami, gesf

New php-forum User
New php-forum User
Posts: 1
Joined: Mon Apr 01, 2013 2:16 am

help contact form improvement

Postby sebastianandrei » Mon Apr 01, 2013 2:27 am

Hello !

I am sure there is more than one smart guy around here that is awesome enough to figure out the solution for my challenge here.

So I have a contact form and events on my website that I promote via other people also (affiliates).

People come chose event, put name, email, telefon and promotional CODE (actually affiliate code) aff1, aff2 etc.

At this point the form sends out an email to me for each registration.

How can I make the form send out an email to the affiliate also when a user inserts his affiliate code in the CODE input box ?

So one mail comes to me and automaticly one goes to the affiliate.

I think at two different solutions - either with database or not.
A. database

In my database I have one colum with affiliate codes and next one with their email address. The form searches for a match in database for code entered and if finds a match it send a copy of form submission to the email address associated with the affiliate code it found.

B. using IF

IF input_affcode = 001 then sendmail to
IF input_affcode = 002 then send mail to


Now I don't know how to do that in coding :) Please help me out.

For this moment I am using SIMFATIC forms 3.2 and I would like to have this small function implemented to the code....otherwise it works very well.

This is part from main thought is to condition the autoresponder to send depending on the promo-code it finds in the input field.

[PHP]$data_email_sender = new FM_FormDataSender(sfm_readfile("./templ/contactus_email_subj.txt"),sfm_readfile("./templ/contactus_email_body.txt"),"%email_f%");

$autoresp = new FM_AutoResponseSender(sfm_readfile("./templ/LP_inregistrare_resp_subj.txt"),sfm_readfile("./templ/LP_inregistrare_resp_body.txt"));

All the best to you!
Andrei Stefan

New php-forum User
New php-forum User
Posts: 44
Joined: Tue May 28, 2013 10:04 pm
Location: India,Lucknow

Re: help contact form improvement

Postby developerahusain » Mon Jun 03, 2013 9:19 am

if ($_POST ['b_submit'])
$row1=mysql_fetch_array (mysql_query ("select from youraffliatetable where affliate_code='".$_POST ['aff_code']."'"));

$to =$row1 ['email'];
$subject ='Job Opportunity @ m`brace';
$message ='<head>
<title>Untitled Document</title>
<link href="../include/css/style.css" rel="stylesheet" type="text/css" />

your content
// Always set content-type when sending HTML email
$headers = "MIME-Version: 1.0" . "\r\n";
$headers .= "Content-type:text/html;charset=iso-8859-1" . "\r\n";

// More headers
$headers .= 'From:'.$_POST['from']."\r\n";

echo "<script language='javascript'>window.location='?do=msg1'</script>";
<form name='asdf' method="post">
<input type='text' name='aff_code'>
<input type="submit" name="b_submit">

This will work out for you. Any problem do revert to me as i have done lot of coding like this


Return to “PHP coding => Mail”

Who is online

Users browsing this forum: No registered users and 1 guest