I’m not really a php person but I tried to do my best before running for help I’m trying to make a “personality quiz” like function or decision tree. Basically, users answer questions on our form and depending on their answer we recommend a product to them and an email gets sent to us telling us their info if they’d like us to contact them. The javascript portion (calculating which product is best) works well. I just finished formatting the php part and am stuck. When I hit submit on my form it will redirect to the php and then display a blank page. I tried echoing variables but to no avail. I’m not even sure if what I’m trying to do can be done this way.
Here’s my code, I’m shortening the form part for space reasons.
[code]
Where to StartName: | |||
Address: | |||
Email: | |||
Phone: | |||
Would you like us to contact you to assist and provide product recommendations? |
|
Brand New
Less than 2 years
2 - 5 years
5 - 10 years
10+ years
Do you currently own biofeedback equipment?:
Yes
Type:
<input TYPE="radio" id="5" NAME="b" VALUE="no">
No<br>
<br>
Do you currently own neurofeedback equipment?:
Yes
Type:
…
[php]<?php
if(isset($_POST[‘submit’])) {
$to = “removed…”;
$toa = “removed…”;
$tob = “removed…”;
$subject = “1”;
$subject2 = “2”;
$subject3 = “3”;
$name_field = $_POST[‘name’];
$email_field = $_POST[‘email’];
$address = $_POST[‘address’];
$phone = $_POST[‘phone’];
$contact = $_POST[‘contact’];
$experience = $_POST[‘a’];
$bioOwn = $_POST[‘b’];
$bioType = $_POST[‘bioType’];
$neuroOwn = $_POST[‘c’];
$neuroType = $_POST[‘neuroType’];
$goal = $_POST[‘d’];
$business = $_POST[‘e’];
$licensedSpecialty = $_POST[‘licensedPractitioner’];
$unlicensedSpecialty = $_POST[‘unlicensedPractitioner’];
$existingBusiness = $_POST[‘f’];
$customerBase = $_POST[‘g’];
$clientDistance = $_POST[‘h’];
$wantToKnow = $_POST[‘i’];
$techSmarts = $_POST[‘j’];
$feedbackType = $_POST[‘k’];
$bioPeriph = $_POST[‘l’];
$bioOther = $_POST[‘bioOther’];
$neuroPeriph = $_POST[‘m’];
$neuroOther = $_POST[‘neuroOther’];
$amountOfSystems = $_POST[‘n’];
$percentBusiness = $_POST[‘o’];
$consideringBio = $_POST[‘p’];
$percentIncome = $_POST[‘q’];
$budget = $_POST[‘r’];
$referralType = $_POST[‘s’];
$headers = “From: $email_field”;
$result = $_POST [“total”]; //Not sure if this is correct…
echo $result;
echo $address;
switch($result) {
case “total” <222:
$body = “From: $name_field\n E-Mail: $email_field\n Address: $address\n City: $city\n State: $state\n PostalCode: $zip\n Department $selected\n How did you about us: $hear\n Country: $country\n Comments: $comment”;
mail($to,$subject,$body, $headers);
header(“Location: http://www.mysite1.com/page/thank-you/”);
exit;
case “total” <325:
$body = “From: $name_field\n E-Mail: $email_field\n Address: $address\n City: $city\n State: $state\n PostalCode: $zip\n Department $selected\n How did you about us: $hear\n Country: $country\n Serial Number: $serial\n Comments: $comment”;
mail($toa, $subject2, $body, $headers);
header(“Location: http://www.mysite2.com/page/thank-you/”);
exit;
die("<Please click the back button to enter a valid serial number!");
default:
die("Invalid selection.");
}
}
?>[/php]
I’m aware that some fields in the email part don’t make sense. I was trying to get it to work or display SOMETHING before I finish editing out what I want the email body to say, etc.
Can anyone please tell me what I’m doing wrong? Thank you!!