Greetings, and please help me

Okay, I want to first indicate that I have not touched PHP or any coding outside of RGSS3 since like 2004. In high school. Where I was forced to. lol.

Here’s what I need:

I have an online Request for Quotation form with a drop-down menu. If the client selects “commercial” from the drop-down menu, then it goes to two emails, and if the client selects “Military” from the drop-down menu, it goes to two other emails.

I have the form and drop-down menu set up properly, and assigning the calls properly. I can get ti to send emails 100% until I try and add that conditional branch in there. Can somebody please tell me what is going wrong with this? Any help would be sincerely appreciated.

[php]

<?php if($user == "Commercial"){ $to = "[email protected]"; $cc = "[email protected]"; }elseif($user == "Military"){ $to = "[email protected]"; $cc = "[email protected]"; }else{ echo "Please specify end user."; } $company = $_POST['company']; $name = $_POST['name']; $email = $_POST['email']; $phone = $_POST['phone']; $fax = $_POST['fax']; $user = $_POST['user']; $pn= $_POST['pn']; $nomen = $_POST['nomen']; $qty = $_POST['qty']; $dolladolla = $_POST['dolladolla']; $comments = $_POST['comments']; $formcontent="From: $name \n Company: $company \n Phone Number: $phone \n Fax: $fax \n Email Address: $email \n End User: $user \n NSN: $nsn \n Part Number: $pn \n Description: $nomen \n Quantity: $qty \n Target Price: $dolladolla \n Comments: $comments"; $recipient = $to.", ".$cc; $subject = "Contact Form"; $mailheader = "From: $email \r\n"; mail($recipient, $subject, $formcontent, $mailheader) or die("Error!"); echo "Thank you for your submission. A representative from STAT Industry will contact you shortly with your requested information. You will be re-directed shortly."; } ?>[/php]

I apologize, I should have included this in the original post, but I get this message when I click submit:

Parse error: syntax error, unexpected ‘}’ in D:\Hosting\3419477\html\mail.php on line 33

mail.php is the attached code above. THank you again.

Hi,

First of all, this line: $user = $_POST[‘user’]; MUST appear before the conditional statements. In your current code, you are trying to compare the variable $user with the values Commercial and Military but since this line: $user = $_POST[‘user’]; does not appear before the conditional statement, variable $user doesn’t have any value therefore it will always goes to else. So put this line: $user = $_POST[‘user’]; before the conditional statements and it would work.

Secondly, the error message definitely means that you have a } symbol which is not supposed to be there. Just above the ?> remove the } symbol.

Regards,
developer.dex2908

Aaaand I should have known that from my work in RGSS3. Thank you for pointing out my absolute stupidity. For some reason my boss thinks that since I fix computers and electronics I should know how to to PHP and everything else.

Hi,

No problem… Glad i could help :slight_smile:

Regards,
developer.dex2908

Sponsor our Newsletter | Privacy Policy | Terms of Service