Please help me. I have a html form with a date picker named “form.html”- here’s the code -
<span id="calendar_1">
<img id="cal_img_1" class="datepicker" src="calendar.gif" alt="Pick a date.">
</span>
<script type="text/javascript">
Calendar.setup({
inputField : "element_1_3",
baseField : "element_1",
displayArea : "calendar_1",
button : "cal_img_1",
ifFormat : "%B %e, %Y",
onSelect : selectDate
});
</script>
The problem that I am having is writing the php script so that the date i select in the date picker with populate to my MySql database. The name of my php script page is NForms.php here is the code I have on it.
$sql=“INSERT INTO ClassLeadersReport (element_1, element_2)
VALUES
(’$_POST[element_1]’,’$_POST[element_2]’)”;
if (!mysql_query($sql,$con))
{
die('Error: ’ . mysql_error());
}
//echo “Record Added Successfully”;
mysql_close($con)
When I check my database - it just displays 0000 00 00 in the date field and 00.0 in the price field.
Please assist me. Thank you so much for any suggestions. " I am a newbie to PHP "