Jump to content

php T-String Error.


Recommended Posts

I keep getting the

Parse error: syntax error, unexpected T_STRING in /home/content/e/d/g/edgeofamerica/html/src/sendorder.php on line 49

 

I have looked through my code and there were no obvious errors. As I am fairly new to this, can someone else give me a hand?

 

 

<?php

$m1 = $_POST['m1'];
$m2 = $_POST['m2'];
$e1 = $_POST['e1'];
$e2 = $_POST['e2'];
$pc = $_POST['pc'];
$br = $_POST['br'];
$cn = $_POST['cn'];
$fn = $_POST['fn'];
$bld = $_POST['bld'];
$eld = $_POST['eld'];

if (eregi('http:', $bld)) {
die ("Naughty Naughty! ");
}
if(!$e1 == "" && (!strstr($e1,"@") || !strstr($e1,".")))
{
echo "<h2>Error - Enter valid e-mail</h2>\n";
$badinput = "<h2>Form Not Sent</h2>\n";
echo $badinput;
die ("Go back! ! ");
}

if(empty($m1) || empty($e1) || empty($bld )) {
echo "<h2>Error - fill in all fields</h2>\n";
die ("Use back! ! ");
}

$todayis = date("l, F j, Y, g:i a") ;

$m1 = $m1;
$subject = $m1;

$cn = stripcslashes($cn);

$message = " $todayis [EST] \n
Main Tenanat Name : $m1 \n
Secondary Tenant Name: $m2 \n
Primary Tenant Email: $m1 ($e1)\n
Secondary Tenant Email: $e2 \n
Property Code: $pc
Bedrooms: $br
Coordinator Name: $cn \n
Firm Name: $fn \n 
Begin Lease Date: $bld \n
End Lease Date: $eld \n

$from = "From: $m1\r\n";


mail("[email protected],", $subject, $message, $from);

?>
<p align="center">
Date: <?php echo $todayis ?>
<br />
Thank You : <?php echo $m1 ?> ( <?php echo $e1 ?> )
<hr />
</p>

 

Thanks.

Matthew

Link to comment
https://forums.phpfreaks.com/topic/194256-php-t-string-error/
Share on other sites

The solution has been given a few times.

here's the updated code for you to just copy and paste. that error will be removed, can't account for any other errors you may have, but that specific one you mentioned is easily resolved by one character added to the end of line 49.

 

<?php

$m1 = $_POST['m1'];
$m2 = $_POST['m2'];
$e1 = $_POST['e1'];
$e2 = $_POST['e2'];
$pc = $_POST['pc'];
$br = $_POST['br'];
$cn = $_POST['cn'];
$fn = $_POST['fn'];
$bld = $_POST['bld'];
$eld = $_POST['eld'];

if (eregi('http:', $bld)) {
die ("Naughty Naughty! ");
}
if(!$e1 == "" && (!strstr($e1,"@") || !strstr($e1,".")))
{
echo "<h2>Error - Enter valid e-mail</h2>\n";
$badinput = "<h2>Form Not Sent</h2>\n";
echo $badinput;
die ("Go back! ! ");
}

if(empty($m1) || empty($e1) || empty($bld )) {
echo "<h2>Error - fill in all fields</h2>\n";
die ("Use back! ! ");
}

$todayis = date("l, F j, Y, g:i a") ;

$m1 = $m1;
$subject = $m1;

$cn = stripcslashes($cn);

$message = " $todayis [EST] \n
Main Tenanat Name : $m1 \n
Secondary Tenant Name: $m2 \n
Primary Tenant Email: $m1 ($e1)\n
Secondary Tenant Email: $e2 \n
Property Code: $pc
Bedrooms: $br
Coordinator Name: $cn \n
Firm Name: $fn \n 
Begin Lease Date: $bld \n
End Lease Date: $eld \n"

$from = "From: $m1\r\n";


mail("[email protected],", $subject, $message, $from);

?>
<p align="center">
Date: <?php echo $todayis ?>
<br />
Thank You : <?php echo $m1 ?> ( <?php echo $e1 ?> )
<hr />
</p>

Link to comment
https://forums.phpfreaks.com/topic/194256-php-t-string-error/#findComment-1022171
Share on other sites

the above code will still return a T_STRING error because there is no semicolon

This code should work:

<?php

$m1 = $_POST['m1'];
$m2 = $_POST['m2'];
$e1 = $_POST['e1'];
$e2 = $_POST['e2'];
$pc = $_POST['pc'];
$br = $_POST['br'];
$cn = $_POST['cn'];
$fn = $_POST['fn'];
$bld = $_POST['bld'];
$eld = $_POST['eld'];

if (eregi('http:', $bld)) {
die ("Naughty Naughty! ");
}
if(!$e1 == "" && (!strstr($e1,"@") || !strstr($e1,".")))
{
echo "<h2>Error - Enter valid e-mail</h2>\n";
$badinput = "<h2>Form Not Sent</h2>\n";
echo $badinput;
die ("Go back! ! ");
}

if(empty($m1) || empty($e1) || empty($bld )) {
echo "<h2>Error - fill in all fields</h2>\n";
die ("Use back! ! ");
}

$todayis = date("l, F j, Y, g:i a") ;

$m1 = $m1;
$subject = $m1;

$cn = stripcslashes($cn);

$message = " $todayis [EST] \n
Main Tenanat Name : $m1 \n
Secondary Tenant Name: $m2 \n
Primary Tenant Email: $m1 ($e1)\n
Secondary Tenant Email: $e2 \n
Property Code: $pc
Bedrooms: $br
Coordinator Name: $cn \n
Firm Name: $fn \n 
Begin Lease Date: $bld \n
End Lease Date: $eld \n";

$from = "From: $m1\r\n";


mail("[email protected],", $subject, $message, $from);

?>
<p align="center">
Date: <?php echo $todayis ?>
<br />
Thank You : <?php echo $m1 ?> ( <?php echo $e1 ?> )
<hr />
</p>

Link to comment
https://forums.phpfreaks.com/topic/194256-php-t-string-error/#findComment-1022176
Share on other sites

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.