NickMahon
12-08-2002, 02:10 PM
Hi,
Why does the following code return this error [Parse error: parse error, unexpected T_STRING in /home/virtual/site58/fst/var/www/html/inquire.php on line 142]?
It is driving me insane.
<html>
<head>
<title>Inquire</title>
</head>
<body>
<?
if(isset($Submit)){
if($iscustomer=="yes"){
$value[iscustomeryes] = " checked";
}
if($iscustomer=="no"){
$value[iscustomerno] = " checked";
}
if($isemerg=="yes"){
$value[isemergyes] = " checked";
}
if($isemerg=="no"){
$value[isemergno] = " checked";
}
$value[name] = " value=\"$_POST[name]\"";
$value[phone] = " value=\"$_POST[phone]\"";
$value[email] = " value=\"$_POST[email]\"";
$value[ordernum] = " value=\"$_POST[ordernum]\"";
$value[howdidyouhear] = " value=\"$_POST[howdidyouhear]\"";
$value[specifics] = $_POST[specifics];
}
$isvalid = 0;
if(isset($_POST[Submit])){
if(!$_POST[iscustomer]){
$isvalid = 0;
$error = "You must tell us if you are a current customer.";
} elseif ($_POST[iscustomer]=="yes"){
if(!$_POST[name]||!$_POST[phone]||!$_POST[email]||!$_POST[ordernum]||!$_POST[howdidyouhear]||!$_POST[isemerg]||!$_POST[specifics]||!$_POST[department]){
$isvalid = 0;
$error = "You must fill out all of the fields in the form.";
} else {
$isvalid = 1;
}
} elseif ($_POST[iscustomer]=="no"){
if(!$_POST[name]||!$_POST[email]||!$_POST[howdidyouhear]||!$_POST[specifics]||!$_POST[department]){
$isvalid = 0;
$error = "You must fill out your name, e-mail, how you heard about us, the specifics, and select a department.";
} else {
$isvalid = 1;
}
}
}
if($isvalid==0){
echo("<strong>$error</strong><br><br>");
?>
<form method="post" action="inquire.php">
<p><strong>Are you a current customer of ours?</strong><br>
<input type="radio" name="iscustomer" value="yes"<?=$value[iscustomeryes]?>>
Yes
<input type="radio" name="iscustomer" value="no"<?=$value[iscustomerno]?>>
No</p>
<p><strong>Your Name:
<input name="name" type="text" id="name"<?=$value[name]?>>
<br>
Phone
Number:</strong> <strong>
<input name="phone" type="text" id="phone"<?=$value[phone]?>>
</strong><br>
<strong>E-Mail Address:
<input name="email" type="text" id="email"<?=$value[email]?>>
</strong><br>
<strong>Order Number:
<input name="ordernum" type="text" id="ordernum" value="<?
if(isset($value[ordernum])) {
echo("$value[ordernum]");
} else {
echo("TSOLS-");
}
?>">
</strong><br>
If you have forgotten your order number, simply enter TSOLS-00000<br>
<strong>How did you hear about us?
<input name="howdidyouhear" type="text" id="howdidyouhear" size="50"<?=$value[howdidyouhear]?>>
</strong></p>
<p><strong>Is this an emergency?</strong><br>
<input type="radio" name="isemerg" value="yes"<?=$value[isemergyes]?>>
Yes
<input type="radio" name="isemerg" value="no"<?=$value[isemergno]?>>
No<br>
(Abuse of this feature will result in deletion of your message)</p>
<p><strong>Specifics:<br>
<textarea name="specifics" cols="70" rows="10" wrap="VIRTUAL" id="specifics"><?=$value[specifics]?></textarea>
</strong></p>
<p><strong>Please select a department to forward this request to:<br>
<select name="department" id="department">
<option>Select One...</option>
<option value="Order Status Request">Order Status Request</option>
<option value="Customer Service">Customer Service</option>
<option value="Vendor Inquries">Vendor Inquries</option>
<option value="Marketing Inquries">Marketing Inquries</option>
</select>
</strong></p>
<p><strong>
<input type="submit" name="Submit" value="Submit">
</strong></p>
</form>
<?
} elseif($isvalid==1){
if($_POST[isemerg]=="yes"){
$emerg = "[Emergency] ";
}
$other = "Your Company: ";
$other2 = "$_POST[department];
$subject = $emerg.$other.$other2;
$message = "This is an automatically-generated e-mail.".
"Past customer? ".$_POST[iscustomer]."".
"Name: ".$_POST[name]."".
"E-Mail: ".$_POST[email]."".
"Phone Number: ".$_POST[phone]."".
"Order Number: ".$_POST[ordernum]."".
"How they heard:".
$_POST[howdidyouhear].
$_POST[specifics];
mail("service@blah.com", $subject, $message, "From: ".$_POST[email]");
}
?>
</body>
</html>
Why does the following code return this error [Parse error: parse error, unexpected T_STRING in /home/virtual/site58/fst/var/www/html/inquire.php on line 142]?
It is driving me insane.
<html>
<head>
<title>Inquire</title>
</head>
<body>
<?
if(isset($Submit)){
if($iscustomer=="yes"){
$value[iscustomeryes] = " checked";
}
if($iscustomer=="no"){
$value[iscustomerno] = " checked";
}
if($isemerg=="yes"){
$value[isemergyes] = " checked";
}
if($isemerg=="no"){
$value[isemergno] = " checked";
}
$value[name] = " value=\"$_POST[name]\"";
$value[phone] = " value=\"$_POST[phone]\"";
$value[email] = " value=\"$_POST[email]\"";
$value[ordernum] = " value=\"$_POST[ordernum]\"";
$value[howdidyouhear] = " value=\"$_POST[howdidyouhear]\"";
$value[specifics] = $_POST[specifics];
}
$isvalid = 0;
if(isset($_POST[Submit])){
if(!$_POST[iscustomer]){
$isvalid = 0;
$error = "You must tell us if you are a current customer.";
} elseif ($_POST[iscustomer]=="yes"){
if(!$_POST[name]||!$_POST[phone]||!$_POST[email]||!$_POST[ordernum]||!$_POST[howdidyouhear]||!$_POST[isemerg]||!$_POST[specifics]||!$_POST[department]){
$isvalid = 0;
$error = "You must fill out all of the fields in the form.";
} else {
$isvalid = 1;
}
} elseif ($_POST[iscustomer]=="no"){
if(!$_POST[name]||!$_POST[email]||!$_POST[howdidyouhear]||!$_POST[specifics]||!$_POST[department]){
$isvalid = 0;
$error = "You must fill out your name, e-mail, how you heard about us, the specifics, and select a department.";
} else {
$isvalid = 1;
}
}
}
if($isvalid==0){
echo("<strong>$error</strong><br><br>");
?>
<form method="post" action="inquire.php">
<p><strong>Are you a current customer of ours?</strong><br>
<input type="radio" name="iscustomer" value="yes"<?=$value[iscustomeryes]?>>
Yes
<input type="radio" name="iscustomer" value="no"<?=$value[iscustomerno]?>>
No</p>
<p><strong>Your Name:
<input name="name" type="text" id="name"<?=$value[name]?>>
<br>
Phone
Number:</strong> <strong>
<input name="phone" type="text" id="phone"<?=$value[phone]?>>
</strong><br>
<strong>E-Mail Address:
<input name="email" type="text" id="email"<?=$value[email]?>>
</strong><br>
<strong>Order Number:
<input name="ordernum" type="text" id="ordernum" value="<?
if(isset($value[ordernum])) {
echo("$value[ordernum]");
} else {
echo("TSOLS-");
}
?>">
</strong><br>
If you have forgotten your order number, simply enter TSOLS-00000<br>
<strong>How did you hear about us?
<input name="howdidyouhear" type="text" id="howdidyouhear" size="50"<?=$value[howdidyouhear]?>>
</strong></p>
<p><strong>Is this an emergency?</strong><br>
<input type="radio" name="isemerg" value="yes"<?=$value[isemergyes]?>>
Yes
<input type="radio" name="isemerg" value="no"<?=$value[isemergno]?>>
No<br>
(Abuse of this feature will result in deletion of your message)</p>
<p><strong>Specifics:<br>
<textarea name="specifics" cols="70" rows="10" wrap="VIRTUAL" id="specifics"><?=$value[specifics]?></textarea>
</strong></p>
<p><strong>Please select a department to forward this request to:<br>
<select name="department" id="department">
<option>Select One...</option>
<option value="Order Status Request">Order Status Request</option>
<option value="Customer Service">Customer Service</option>
<option value="Vendor Inquries">Vendor Inquries</option>
<option value="Marketing Inquries">Marketing Inquries</option>
</select>
</strong></p>
<p><strong>
<input type="submit" name="Submit" value="Submit">
</strong></p>
</form>
<?
} elseif($isvalid==1){
if($_POST[isemerg]=="yes"){
$emerg = "[Emergency] ";
}
$other = "Your Company: ";
$other2 = "$_POST[department];
$subject = $emerg.$other.$other2;
$message = "This is an automatically-generated e-mail.".
"Past customer? ".$_POST[iscustomer]."".
"Name: ".$_POST[name]."".
"E-Mail: ".$_POST[email]."".
"Phone Number: ".$_POST[phone]."".
"Order Number: ".$_POST[ordernum]."".
"How they heard:".
$_POST[howdidyouhear].
$_POST[specifics];
mail("service@blah.com", $subject, $message, "From: ".$_POST[email]");
}
?>
</body>
</html>
