I'm rather new with sql statements in PHP and got following error:
Parse error: syntax error, unexpected '$POST_' (T_VARIABLE) in /home/u544596746/public_html/cobrahd/register.php on line 19
I looked the error up on the Internet, but only found other guys with the same problem for other code.
I would be happy if you could solve my problem.
<?php
define('DB_HOST', '****');
define('DB_NAME', '****');
define('DB_USER','****');
define('DB_PASSWORD','****');
$con=mysql_connect(DB_HOST,DB_USER,DB_PASSWORD) or die("Failed to connect to MySQL: " . mysql_error());
$db=mysql_select_db(DB_NAME,$con) or die("Failed to connect to MySQL: " . mysql_error());
function register()
{
session_start();
if($_POST["email"]!="" and $_POST["password"]!="" and $_POST["username"]!="" and $_POST["password"]== $_POST["password_confirm"])
{
$sql = "INSERT INTO `tblUser`(`UserName`, `Vorname`, `Nachname`, `EMail`, `Geschlecht`, `Geburtsdatum`, `RegestrierungDate`, `Password`, `FKRole`) VALUES ('" .$POST_['username']. "','"$POST_['vorname']. "','" .$POST_['nachname']. "','" .$POST_['email']. "','" .$POST_['geschlecht']. "','" .$POST_['geburtsdatum']. "',Curdate(),'" .$POST_['password']. "',2)";
echo $sql;
header('Location: index.php');
}
else
{
header('Location: 404.html');
}
}
if(isset ($_POST['submit']))
{
register();
}
?>