craigglenn
Technical User
I am receiving the following error in my php file. I have searched for syntax errors but just can put my finger on it.
Parse error: syntax error, unexpected T_VARIABLE in /home/content/b/a/r/barbmcvicker/html/includes/insert_tips_request.php on line 3
PHP code:
<?php
require_once("configuration.php");?
$jconfig = new JConfig();
$con = mysql_connect($jconfig->host, $jconfig->user, $jconfig->password);
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
mysql_select_db($jconfig->db, $con);
$_first = $_POST['FirstName'];
$_last = $_POST['LastName'];
$_email = $_POST['Email'];
$regexp = "/^[^0-9][A-z0-9_]+([.][A-z0-9_]+)*[@][A-z0-9_]+([.][A-z0-9_]+)*[.][A-z]{2,4}$/";
$sql = "INSERT INTO jos_request (FirstName, LastName, Email, Request, DateCreated)
VALUES ('.mysql_real_escape_string($_first).','.mysql_real_escape_string($_last).','.mysql_real_escape_string($_email).','.mysql_real_escape_string('Newsletter and Tips').','.getdate().')";
if ($_first=$_last)
{
die('FirstName cannot be equal to LastName' . mysql_error());
}
if (preg_match($regexp, $_email))
{
mysql_query($sql);
}
else
{
die('Invalid Email Address' . mysql_error());
}
mysql_close($con);
?>
Thanks in advance for your help.
"You can have anything in life you want if you help enough people get what they want"
Zig Ziggler
Parse error: syntax error, unexpected T_VARIABLE in /home/content/b/a/r/barbmcvicker/html/includes/insert_tips_request.php on line 3
PHP code:
<?php
require_once("configuration.php");?
$jconfig = new JConfig();
$con = mysql_connect($jconfig->host, $jconfig->user, $jconfig->password);
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
mysql_select_db($jconfig->db, $con);
$_first = $_POST['FirstName'];
$_last = $_POST['LastName'];
$_email = $_POST['Email'];
$regexp = "/^[^0-9][A-z0-9_]+([.][A-z0-9_]+)*[@][A-z0-9_]+([.][A-z0-9_]+)*[.][A-z]{2,4}$/";
$sql = "INSERT INTO jos_request (FirstName, LastName, Email, Request, DateCreated)
VALUES ('.mysql_real_escape_string($_first).','.mysql_real_escape_string($_last).','.mysql_real_escape_string($_email).','.mysql_real_escape_string('Newsletter and Tips').','.getdate().')";
if ($_first=$_last)
{
die('FirstName cannot be equal to LastName' . mysql_error());
}
if (preg_match($regexp, $_email))
{
mysql_query($sql);
}
else
{
die('Invalid Email Address' . mysql_error());
}
mysql_close($con);
?>
Thanks in advance for your help.
"You can have anything in life you want if you help enough people get what they want"
Zig Ziggler