Hi there
Please help, the form suppose to send email to different email address depending on enquiry option selected. Currently the form doesn’t do that and I cant seem to find or fix this issue.
Contact page code
[php] <?php
require_once(‘src/config.php’);
$VarSecurity = new VarSecurity();
$enquiry = NULL;
$chk_Locate = FALSE;
if((isset($_GET[‘enquiry’]) && $_GET[‘enquiry’]==‘Locate a dealer/distributor’)||(isset($_POST[‘enquiry’]) && $_POST[‘enquiry’]==‘Locate a dealer/distributor’)){
$chk_Locate=TRUE;
}
if(isset($_GET[‘enquiry’]) && $_GET[‘enquiry’] == ‘CC’){
$query_recipients = array(array(‘Complaint’, ‘[email protected]’),
array(‘Suggestion’, ‘[email protected]’),
array(‘Compliment’, ‘[email protected]’));
$enquiry = ‘’;
}
else{
$query_recipients = array(array(‘Locate a dealer/distributor’, ‘[email protected]’),
array(‘Technical support’, ‘[email protected]’),
array(‘Back orders’, ‘[email protected]’),
array(‘Product enquiry’, ‘[email protected]’),
array(‘Catalog request’, ‘[email protected]’),
array(‘New customer enquiry’, ‘[email protected]’),
array(‘Existing customers - logon’, ‘[email protected]’),
array(‘Existing customers - orders’, ‘[email protected]’),
array(‘Report web problems’, ‘[email protected]’));
}
$enquiry_options = ‘’;
$selected_notes = ‘’;
$item = NULL;
if(isset($_GET[‘item’])){
$item=$_GET[‘item’];
}
foreach($query_recipients as $key => $val){
if((isset($_POST[‘enquiry’]) && $_POST[‘enquiry’] == $val[0])||(isset($_GET[‘enquiry’]) && $_GET[‘enquiry’] == $val[0])){
$selected = $val[0].’ : ‘.$item;
if($val[0]==‘Existing customers - logon’||$val[0]==‘Technical support’||$val[0]==‘Catalog request’||$val[0]==‘Product enquiry’||$val[0]==‘New customer enquiry’||$val[0]==‘Existing customers - orders’||$val[0]==‘Catalog request’){
$selected_notes = ‘
• If you are an EXISTING Radiant dealer please enter you Radiant account number so that we can correctly deal with your enquiry. Please enter your username and password for verification purposes (your login details are not sent with the enquiry). If you are already logged in you will not need to enter this information
• Please enter
Radiant only supplies to appointed distributors, and not direct to the public.
However, our showrooms are open to the public daily, where you can view our product range and get assistance with your queries.
’;}elseif($val[0]==‘Locate a dealer/distributor’){
$selected_notes = ‘
• Please supply your area details in the message body, as well as surrounding suburbs
’;
}
}
$enquiry_options .= ‘’.$val[0].’’;
$recpt_email = $val[1];
}
if(empty($selected)){
$selected = ‘Select option’;
$selected_notes = ‘
• If you are an EXISTING Radiant dealer please enter you Radiant account number so that we can correctly deal with your enquiry. Please enter your username and password for verification purposes (your login details are not sent with the enquiry). If you are already logged in you will not need to enter this information
Radiant only supplies to appointed distributors, and not direct to the public.
However, our showrooms are open to the public daily, where you can view our product range and get assistance with your queries.
’;}
$cont_ref = NULL;
$ref_number = NULL;
if(isset($_POST[‘name’])){
$VarSecurity->protectform();
if ($Session->ID()==NULL){
$query = @mysql_query('SELECT Accnr FROM WEB_Cust WHERE Uname="'.$_POST['dealer_username'].'" AND Pword="'.md5($_POST['dealer_password']).'" AND active=1 AND AXblocked!=2 LIMIT 0,1');
$login = @mysql_num_rows($query);
if($login==1){
$cust_verify = 'Dealer is verified';
$contact_email = '[email protected]';
$Session->Logout(NULL);
} else {
$cust_verify = 'Dealer not verfied: username/password supplied but did not match our records.';
}
}elseif($Session->ID()!=NULL){
$cust_verify = 'Dealer is verified';
$contact_email = '[email protected]';
}else{
$cust_verify = 'Dealer not verfied: username/password not supplied.';
}
if(isset($_POST['enquiry']) && $_POST['enquiry'] == 'CC'){
$done = false;
while(!$done){
$ref_number = 'web'.strtolower(substr(str_replace(' ', '', $_POST['company']), 0, 1)).substr(md5(microtime()), 0, 5);
$unique_query = @mysql_query('SELECT * FROM web_cms_feedback WHERE ref_number="'.$ref_number.'"');
if(@mysql_num_rows($unique_query) == 0){
$done = true;
}
}
$insert_query = @mysql_query('INSERT INTO web_cms_feedback (Web_ref, Name, Surname, Company, Accnr, Email, Tel_cell, Enquiry, Message)
VALUES ("'.$ref_number.'", "'.$_POST['name'].'", "'.$_POST['surname'].'", "'.$_POST['company'].'", "'.$_POST['accnr'].'", "'.$_POST['email'].'", "'.$_POST['tel'].'", "'.$_POST['enquiry'].'", "'.$_POST['message'].'")');
$insert_data = @mysql_fetch_array($insert_query);
$cont_ref = '<br>
<h4>Reference: '.$ref_number.'</h4>
You will receive an automated response to your email address shortly';
}
$_POST['recipient_email'] = $contact_email.','.$recpt_email;
if(isset($ref_number)){
$_POST['subject'] = 'Radiant Group: '.$ref_number.': '.$_POST['enquiry'];
}else{
$_POST['subject'] = 'Radiant Group: '.$_POST['enquiry'];
}
$_POST['sender_email'] = $_POST['email'];
$_POST['cc'] = $_POST['email'].', Radiant Group <[email protected]>';
$_POST['body'] = '<p>Name: ' . $_POST['name'] . '</p>'
. '<p>Surname: ' . $_POST['surname'] . '</p>'
. '<p>Company: ' . $_POST['company'] . '</p>'
. '<p>Radiant Account No.: ' . $_POST['accnr'] . '</p>'
. '<p>Account No. verification: ' . $cust_verify . '</p>'
. '<p>Email: ' . $_POST['email'] . '</p>'
. '<p>Tel/cell: ' . $_POST['tel'] . '</p>'
. $_POST['enquiry'] . ': ' . $_POST['message'];
if(Email::Send($_POST, NULL)){
$message = 'Your feedback has been sent'.$cont_ref;
} else {
$message = 'There was an error sending your feedback';
}
}
$Newproducts = new NewProducts();
global $body;
$body = '<div class="column-310 float-left">
<div class="block-khaki home-highlights">
<div class="padding-10">
<h1 class="text-white">Welcome to Radiant</h1>
<br/>
<p>We are committed to a brighter future by creating lighting and electrical solutions which are beautiful by design and inspired by the environment. We are certain that you will find lighting and electrical products that compliment your life space and enlighten you.</p>
</div>
</div>
<div class="gap-hoz-small"></div>
<div class="block-khaki home-newprod">
<div class="padding-10">
<h1 class="text-white">New Products</h1>
</div>
'.$Newproducts->Display().'
</div>
</div>';
echo $body;
?>
Contact feedback
<?php echo (isset($message) ? $message : NULL); ?>
<?php if($Session->ID()==NULL && $chk_Locate==FALSE):?>
<?php elseif($chk_Locate==FALSE):?>
<?php endif?>
<?php echo $selected_notes?>
<?php echo $enquiry?>
Config.php code
[php]<?php
$db_server = ‘100.1001.1001.10’;
$db = ‘Database’;
$db_username = ‘username’;
$db_password = ‘password’;
$title = ‘Radiant Group (Pty) Ltd’;
$env_repo = getenv(‘php_repository’);
if(!empty($env_repo)){
$classes = $env_repo;
} else {
$classes = ‘src/Classes/’;
}
$pagination = array(‘items_per_page’=>300);
$default_page = ‘Home’;
$sales_email = ‘[email protected]’;
$contact_email = ‘[email protected]’;
$image_path = ‘http://www.mycompany.com/src/img/email/’;
?>
[/php]