Jump to content

Parse error: syntax error, unexpected T_STRING on line 29


tim_ver

Recommended Posts

I keep getting this error when I submit my online form:

 

Parse error: syntax error, unexpected T_STRING

 

This is the line it is complaining about:

 

if ($autotype = 1){mail(email to, Email, Thank you for your request. We will be in touch in 24  hours.)};

 

 

What am I missing?

 

Thanks

I am not going to make you all. You have to configure that code block by yourself according to your needs.

I've Just Told that Replace

if ($autotype = 1){mail(email to, Email, Thank you for your request. We will be in touch in 24  hours.)};

With The Above Code I Posted

Ok, I am new to this way of auto response. The issue is the all forms goto the same email account so I need to have a different response for each form defined. I figured this was the easiest but it is not turing out to be it now, better way to do this?

 

I have have four forms and on each for I have this code:

 

$autotype

autotype = 1

 

Then in the send.php the code you gave above plus the line above it I gave.

 

I want it to email the response detailed in the line to the email they give in the text box on the form.

 

So what I am thinking is that the line you have [email protected] need to be replaced with a value like Email and then Email has to be defined in the Send.php, right?

 

Thanks

I think he is asking about use of a variable for the email address.

 

You can do

 

if($autotype == 1)
{
  $header = "From: [email protected] \r\n";
  $email = "[email protected]";
  mail($email, "Subject", "Thank you for your request We will be in touch in 24  hours", $header);
}

 

Similarly, you can replace the subject and/or the message with a variable.

 

If you are still having trouble, please post your full code for us to look at (for just 1 of the forms).  There may be a problem with getting data from the form into the variables as well.

Ok here it is for form1.

 

 

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

<html>

<head>

<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">

<title>Form1</title>

<style type="text/css">

<!--

body,td,th {

font-family: Verdana, Arial, Helvetica, sans-serif;

font-size: 12px;

}

body {

background-image: url();

background-repeat: repeat-y;

background-position:center;

background-color:#ffffff;

margin-left: 0px;

margin-top: 0px;

margin-right: 0px;

margin-bottom: 0px;

}

-->

</style>

</style>

<script type="text/javascript" language="javascript" charset="utf-8">

// <![CDATA[

function Check()

{

error = '';

if(document.frm.Email.value=='') { error += 'Email is required\n'; }

if(document.frm.First_Name.value=='') { error += 'First name is required\n'; }

if(document.frm.Last_Name.value=='') { error += 'Last name is required\n'; }

if(document.frm.Phone_Number.value=='') { error += 'Phone number is required\n'; }

 

if(error!=''){ window.alert(error); return false; }

return true;

}

// ]]>

$autotype

autotype = 1

</script>

</head>

 

<body>

<table width="754" border="0" align="center" cellpadding="0" cellspacing="0">

  <tr>

    <td> </td>

  </tr>

  <tr>

    <td background="images/bg.jpg" align="center"> </td>

  </tr>

  <tr>

    <td> </td>

  </tr-->

  <tr>

    <td height="1955">

<h1 align="center">Online form1</h1>

    <form name="frm" method="post" action="send.php?ID=<?=$_GET['ID'];?>" onsubmit="javascript: return Check();">

    <table width="100%" cellpadding="12">

    <tr>

            <td>Please fill out this form.</td>

          </tr>

    <tr><td>Right now I am:</td></tr>

    <tr><td>

    <input type="radio" name="Right_now_I_am" value="Ready to hire"/>

              Ready<br/>

    <input type="radio" name="Right_now_I_am" value="Evaluating "/> Evaluating<br/>

    <input type="radio" name="Right_now_I_am" value="Looking for information"/> Looking for information</td></tr>

    <tr><td>I would like to complete this project by:</td></tr>

    <tr><td>

    <? $months[1] = "January"; $months[2] = "February"; $months[3] = "March"; $months[4] = "April"; $months[5] = "May"; $months[6] = "June"; $months[7] = "July"; $months[8] = "August"; $months[9] = "September"; $months[10] = "October"; $months[11] = "November"; $months[12] = "December"; ?>

    <select name="Project_completion_month">

    <option value="">Month</option>

    <? foreach($months as $month){ ?>

    <option value="<?=$month;?>"><?=$month;?></option>

    <? } ?>

    </select> 

    <select name="Project_completion_year"><option value="">Year</option><? for($now = date('Y'), $i=($now+50); $i>=($now-50); $i--){?><option value="<?=$i;?>"><?=$i;?></option><?}?></select>

    </td></tr>

    <tr><td align="justify">What is your total budget for your project?</td></tr>

    <tr><td>

    <select name="Total_Budget">

                <option value="Less than $ 300" selected>Less than $ 300</option>

                <option value="$300 to $ 1000">$300 to $ 1000</option>

              </select>

    </td></tr>

    <tr><td align="justify">What type of project?</td></tr>

    <tr><td>

    <input type="checkbox" name="Type_of_project[1]" value="New"/>

              Project1<br/>

    <input type="checkbox" name="Type_of_project[2]" value="Existing"/>

              Project2<br/>

    <input type="checkbox" name="Type_of_project[3]" value="Major "/>

              Project3<br/>

    <input type="checkbox" name="Type_of_project[4]" value="Add To"/>

              Project4</td>

          </tr>

    <tr><td align="justify">Please describe the type of project you are looking to have complete:</td></tr>

    <tr><td>

    <textarea name="Describe_type_of_project" style="width:100%; height: 50px;"></textarea>

    </td></tr>

    <tr>

            <td align="justify">Do you have any questionsl.</td>

          </tr>

    <tr><td>

    <select name="survey">

        <option value="--">--</option>

    <option value="Yes">Yes</option>

    <option value="No">No</option>

    </select>

    </td></tr>

    <tr><td>

    <textarea name="Additional_Details" style="width:100%; height: 50px;"></textarea>

    </td></tr>

    <tr>

            <td><b>Street Address:</b></td>

          </tr>

    <tr><td><input type="text" name="Address" size="60"/></td></tr>

    <tr><td>City:</td></tr>

    <tr><td><input type="text" name="City" size="30"/></td></tr>

    <tr><td>State:</td></tr>

    <tr><td><input type="text" name="State" size="2"/></td></tr>

    <tr><td>Zip Code:</td></tr>

    <tr><td><input type="text" name="Zip" size="5"/></td></tr>

    <tr><td><b>Your Contact Information:</b></td></tr>

    <tr><td><font color="red">*</font>Email:</td></tr>

    <tr><td><input name="Email" type="text" size="30"/></td></tr>

    <tr><td><font color="red">*</font>First Name:</td></tr>

    <tr><td><input type="text" name="First_Name" size="40"/></td></tr>

    <tr><td><font color="red">*</font>Last Name:</td></tr>

    <tr><td><input type="text" name="Last_Name" size="40"/></td></tr>

    <tr><td><font color="red">*</font>Phone Number you can be reached at 8-5.  M-F:</td></tr>

    <tr><td><input type="text" name="Phone_Number" size="20"/></td></tr>

    <tr><td>Additional Services</td></tr>

    <tr>

            <td align="justify">Please select other services that you need :</td>

          </tr>

    <tr><td>

    <input type="checkbox" name="Additional_services[1]" value="one"/>one<br/>

    <input type="checkbox" name="Additional_services[2]" value="two"/>two<br/>

    <input type="checkbox" name="Additional_services[3]" value="three"/>

              three</td>

          </tr>

    <tr><td>How did you find out about this website:</td></tr>

    <tr><td>

    <select name="How_did_you_find_us">

    <option value="Online">Online</option>

    <option value="Newspaper">Newspaper</option>

    <option value="Magazine">Magazine</option>

    <option value="Word of mouth">Word of mouth</option>

    <option value="Radio">Radio</option>

    <option value="TV">TV</option>

    </select>

    </td></tr>

    <tr><td align="center"><input type="submit"/></td></tr>

    <tr>

    <td colspan="2"><font color="red">* = Fields are required</font></td>

    </tr>

    </table>

    </form>

    <p>  </p></td>

  </tr>

 

</table>

<center>

</center>

</body>

</html>

 

 

Ahh ok here is the send.php code:

 

<?php

if($_GET['ID']!=''){
session_start();

require('include/kaip.php');
check_install();
c_mysql_connect();

$result = c_mysql_query('SELECT * FROM listings  WHERE listing_approved = 1   AND listing_id = %P LIMIT 1',   array($_GET['ID']));
if(mysql_num_rows($result) != 0)  {
$row = mysql_fetch_assoc($result);
}

}else{
$row['listing_contact'] = "[email protected]";
$row['listing_title'] = "Contact";
}

include("class.phpmailer.php");

$mail = new PHPMailer();

$mail->From     = $_POST['Contact_Name'];

$autotype;
if($autotype == 1)
{
  $header = "From: mydomain.com \r\n";
  $email = "[email protected]";
  mail($email, "Subject", "Thank you for your request We will be in touch in 24  hours", $header);
}


if($_GET['ID']!=''){
$mail->FromName = "{$_POST['First_Name']} {$_POST['Last_Name']}";
$mail->Subject = "Request1";
}else{
$mail->FromName = "{$_POST['Contact_Name']}";
$mail->Subject = "Contact form";
}

$text = "\n"; $html = "<table>";
foreach($_POST as $v=>$l){
    if(is_array($l)) $l=implode(', ', $l);
$text .= "{$v}:  {$l}\n\n";
$html .= "<tr><td>{$v}:</td><td>  {$l}</td></tr>";
}
$html .= "</table>";

$mail->Body    = $html;
$mail->AltBody = $text;
$mail->AddAddress($row['listing_contact'], $row['listing_title']);
if($row['listing_cccontact']!='')
$mail->AddAddress($row['listing_cccontact'], $row['listing_title']);
//$mail->AddAttachment($_FILES['attach']['tmp_name'], $_FILES['attach']['name']);

if(!$mail->Send())
    echo "There has been a mail error sending to Contact<br>";

// Clear all addresses and attachments for next loop
$mail->ClearAddresses();
$mail->ClearAttachments();

?>
<script language="Javascript">
window.alert("Thank you for your request.\n We will contact you soon.");
window.location = "index.php";
</script>

 

(edited to put in the


tags)

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.