michaelpalmer7 Posted March 9, 2008 Share Posted March 9, 2008 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( "info@mydomain.com", $subject, $formcontent, "From: $email" ); header( "Location: http://www.mydomain.com/thankyou.htm" ); } ?> ?> Quote Link to comment Share on other sites More sharing options...
kenrbnsn Posted March 9, 2008 Share Posted March 9, 2008 This syntax <?php if ($suffix == 1,2,3,4,5,6,7,8,9,10) ?> is incorrect You could do it like this: <?php if (in_array($suffix,range(1,10))) ?> Ken Quote Link to comment Share on other sites More sharing options...
michaelpalmer7 Posted March 9, 2008 Author Share Posted March 9, 2008 Hi thanks for the help but unfortuanately on the email the $domainprice field was still empty. It now looks like this: if (in_array($suffix,range(1,10))) { $domainprice = 11.73; } Quote Link to comment Share on other sites More sharing options...
kenrbnsn Posted March 9, 2008 Share Posted March 9, 2008 You need to create the content after assigning all the variables. You're creating it before. Ken Quote Link to comment Share on other sites More sharing options...
michaelpalmer7 Posted March 9, 2008 Author Share Posted March 9, 2008 Thanks a lot works fine now. I suppose it does everything in order, feel a right idiot now lol. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.