Jump to content

Problem with If/Then statements on sendmail file


michaelpalmer7

Recommended Posts

Hi, i wonder if you can help. I have set up a sendmail file for people to fill in a form on my website and this sends me an email. on two of my comboboxes im using if/then statements to convert names to prices to id numbers and this works fine on the email. The problem im having is on the second if/then statement. There is 10 numbers converted to one price and one number converted to a different price and the $domainprice variable wont display anything on the email. I wasnt sure if the commas were the right way of doing it but i did also try it seperately with no luck, i wasnt sure if you needed some kind of seperator between if statements. I have highlighted the problem bit red.   

 

Any help would be greatly appreciated..

<?php


$title = $_REQUEST['title'];
$name = $_REQUEST['name'];
$surname = $_REQUEST['surname'];
$email = $_REQUEST['email'];
$package = $_REQUEST['package'];
$pages = $_REQUEST['pages'];
$contactform = $_REQUEST['contactform'];
$pricepage = $_REQUEST['pricepage'];
$gallery = $_REQUEST['gallery'];
$subject = "Web Design Quotation";
$hosting = $_REQUEST['hosting'];
$domain = $_REQUEST['domain'];
$suffix = $_REQUEST['suffix'];

$totalpages = $pages*25;
$totalcontactform = $contactform*20;
$totalpricepage = $pricepage*10;
$totalgallery = $gallery*20;
$totalprice = $package + $totalpages + $totalcontactform + $totalpricepage + $totalgallery;
$totalhosting = $hosting + $domainprice;
$completetotal = $totalprice + $totalhosting;


$names= "QUOTATION\n\n Dear $title $surname";
$detailsandprice= "Thankyou for your quotation, details are shown below.\n\nDETAILS\n\n$packagepage page package          £ $package\n\n$pages Extra Page/s          £ $totalpages\n\n$contactform Contact/Booking Form/s  £ $totalcontactform\n\n$pricepage Price Page/s          £ $totalpricepage\n\n$gallery Gallery Page/s        £ $totalgallery\n\n\n\nTotal Price of website design and construction = £ $totalprice ";
$hostingcontent= "HOSTING\n\n1 years Hosting:          £ $hosting \n\nRequested Domain Name: $domain$suffix:            £ $domainprice\n\nThis Domain Is:";
$totaltotal= "Complete Total:  £completetotal";

$formcontent= "$names\n\n$detailsandprice\n\n$hostingcontent\n\n$totaltotal";



if ($package == 150) { 
$packagepage = 3; 
} 

if ($package == 180) { 
$packagepage = 5; 
} 

if ($package == 300) { 
$packagepage = 10; 
} ;



////////////////////////////////

[color=red]if ($suffix == 1,2,3,4,5,6,7,8,9,10) { 
$domainprice = 11.73; 
} 

if ($suffix == 11) { 
$domainprice = '23.48'; 
} 
[/color]



if (!isset($_REQUEST['email'])) {
    header( "Location: http://www.mydomain.com" );
  }
  elseif (empty($email)) {
    ?>

  <html>

<head>

</head>

<body bgcolor="#C0C0C0">

<p align="center"><font face="Calligraph421 BT" size="6">An Error Has Occured: 
<b><u><font color="#FF0000">ERROR</font></u></b></font></p>
<p align="center"><font face="Arial" size="5">You haven't included an email 
address so we cannot reply, please click <a href="javascript:history.back()">
HERE</a> to return and include an email address.</font></p>
</body>

</html>
<?
    
  }
   else {
    mail( "[email protected]", $subject,
          $formcontent, "From: $email" );
    header( "Location: http://www.mydomain.com/thankyou.htm" );
}
?>


?>

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.