This function gets the date from the user:
function getCCGraduationDate () {
?>
<form method="post" action="processor.php">
Graduation Date: <input type="text" name="CCgraduationdate"><br>
<input type="submit">
<?php
}
This function sends the value to a DB and is called on the processor.php page:
function sendCCGraduationDate () {
$con = mysql_connect("localhost","root","XXXXXX");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
mysql_select_db("user", $con);
$grad = mysql_real_escape_string($_POST['CCGraduationDate'], $con);
$sql = "UPDATE profile SET CommunityCollegeGraduationDate='$grad' WHERE userid=$this->user_id";
mysql_query( $sql , $con );
mysql_close($con);
}
For some reason the value isn’t populating in the database. I had tested similar functions last night and they worked, not sure what I’m missing here.
Please check this:
FORM CODE:
PHP CODE:
Your
CCgraduationdatein your form is unequal toCCGraduationDatein your php codeIf you’re not getting an error like:
Then you can try adding at the top of your PHP code:
And then see if an error comes out.
Of course, that’s after changing your
$sqlvariable’s data to: