Hi, there. The following is my .php file:

<?php
// Create local variables from the Flash ActionScript posted variables
$senderName   = $_POST['userName'];
$senderEmail     = $_POST['userEmail'];
$senderComments = $_POST['userComments'];
$senderSubject   = $_POST['userSubject'];
$senderComanyName     = $_POST['userCompanyName'];
$senderPhone = $_POST['userPhone'];
$senderFax = $_POST['userFax'];
$senderCity = $_POST['userCity'];
$senderAddress = $_POST['userAddress'];
$senderCountry   = $_POST['userCountry'];
$senderQuery     = $_POST['userQuery'];
$client_ip = $_SERVER['REMOTE_ADDR'];

// Strip slashes on the Local typed-in variables for security and run any php based error check here
$senderName   = stripslashes($senderName);
$senderEmail     = stripslashes($senderEmail);
$senderComments   = stripslashes($senderComments);
$senderAddress   = stripslashes($senderAddress);
$senderSubject   = stripslashes($senderSubject);
$senderComanyName     = stripslashes($senderCompanyName);
$senderPhone = stripslashes($senderPhone);
$senderFax   = stripslashes($senderFax);
$senderCity = stripslashes($senderCity); 

// IMPORTANT - Change these lines to be appropriate for your needs - IMPORTANT !!!!!!!!!!!!!!!!!!
$to = "makviswebsite@gmail.com";			 
$from = "$senderEmail";
$subject = "$senderSubject";
$message = "Results from the website form:

Query Type: $senderQuery
Subject: $senderSubject
Name: $senderName
Company Name: $senderCompanyName
Address: $senderAddress
City: $senderCity
Country: $senderCountry 
Phone: $senderPhone
Fax: $senderFax
Email: $senderEmail

Comments: $senderComments "

// Build $headers Variable

$headers = "From: $from\r\n";
$headers .= "Content-type: text\r\n"; 
$to = "$to";
    // Send the email
    mail($to, $subject, $message, $headers);
if( mail( $to, $subject, $message, $headers ) )
	{ 
    echo 'answer=ok'; 
} 
else 
{ 
    echo 'answer=bad';  
} // Exit script exit(); ?>

And I've been getting the following error:
Parse error: syntax error, unexpected T_VARIABLE in /home2/makvis/public_html/form_parse.php on line 48

Line 48 comes somewhere around $headers. Any help would be appreciated. Thanks in advance.🙂

    You forgot the semicolon to end the previous statement.

      Welcome to PHPBuilder!

      Few issues I see with your code above...

      1. You never check to see if any of that external data exists in the $_POST array, meaning you could be attempting to send e-mails without anything even being POST'ed to the script at all.

        Always check to see if external data exists before accessing it, such as by using [man]isset/man or [man]empty/man.

      2. Remove all instances of stripslashes(); not only does this not provide any sort of "security" contrary to the code comment, but it's also completely unnecessary; if you're seeing backslashes in incoming data, then the real solution is to get the highly deprecated magic_quotes behavior disabled in PHP's configuration. See the following manual page for more info about magic quotes: [man]security.quotes[/man].

      3. If you're going to use a user-supplied e-mail address as the 'From' header, then you must also send a 'Sender' header that points to an e-mail address on the domain from which you are sending these e-mails.

        Otherwise, you're lying about the origin of the message and will very likely get labeled as an open relay and/or a spammer and automatically blacklisted.

      4. Your parse error is being caused by a missing semicolon to end the statement that precedes the variable on the line number referenced in the error message.

      5. You're sending the exact same e-mail message to the same recipients twice. Why is that?

        Write a Reply...