The Following code is from one of my PHP forms. everything works up until what i have highlighted in orange. i have double checked my server variables and i am not getting any error codes, the data from my forms simply is not being passed to the associated database fields.
<html>
<body>
<link href="../css/PHP-BG.css" rel="stylesheet" type="text/css">
<h1>Thank you for your submission</h1>
<?php
//telling the time of day greeting
$time = date("H");
if ($time < "10") {
echo "<h2>Good Morning Champion!</h2>" . "<br>";
} elseif ($time < "15") {
echo "<h2>Good day Champion!</h2>" . "<br>";
} else {
echo "<h2>Good Evening Champion!</h2>" . "<br>";
}
//end of time of day greeting code
//set all form entry data to blank
$CharName = $CharHair = $EyeColor = $PriAttribute = $AltAttribute = $comments ="";
//form data entry
$CharName = $_REQUEST['CharName'];
$CharHair = $_REQUEST['CharHair'];
$EyeColor = $_REQUEST['EyeColor'];
$PriAttribute = $_REQUEST['PriAttribute'];
$AltAttribute = $_REQUEST['AltAttribute'];
$comments = $_REQUEST['comments'];
//end form data entry
// echo statement to print form entry results
echo $CharName;
echo "<br>";
echo "A Truly mighty Hero and worthy of your $PriAttribute Attribute. Thank you for sharing";
echo "<br>";
// This is the output that needs to be placed in the PHP files to initiate and insert data into existing tables
$servername = "xxxx";
$username = "xxxx";
$password = "xxxx";
$dbname = "xxxx";
// Create connection
$link = mysql_connect("xxxx", "xxxx", "xxxx", "xxxx");
// Check connection
if($link === false){
die("ERROR: Could not connect. " . mysqli_connect_error());
}
// items need to reflect whats in database
$sql = "INSERT INTO CharBuild (CharName, HairColor, EyeColor, PriAttribute, AltAttribute)
VALUES ('Grognak', 'White', 'Ice Blue', 'Strength', 'Charisma')";
if(mysqli_query($link, $sql)){
echo "Records inserted successfully.";
} else{
echo "ERROR: Could not able to execute $sql. " . mysqli_error($link);
}
mysqli_close($link);
?>
</body>
</html>