I am trying to make an application with a calendar. What I want is that when the user click to a date of the calendar, to have a output form below where the data appears, and a div tag, where i load the result of the php page. In the php file I ask to upload the result from the database where the date is the same with the one that the user has choose.. But it gives me an error after I click the date:
Notice: Undefined index: dataoutput in C:\xampp\htdocs\rai kalendar\insert.php on line 16
My html file is:
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script>
<script type="text/javascript">
window.onload = function(){
g_globalObject = new JsDatePick({
useMode:1,
isStripped:true,
target:"div3_example"
});
g_globalObject.setOnSelectedDelegate(function(){
var obj = g_globalObject.getSelectedDay();
document.getElementById("dataoutput").innerHTML = obj.year + "-" + obj.month + "-" +obj.day;
$('#div3_example_result').load('insert.php');
});
};
</script>
</head>
<body>
<div id="div3_example" style="margin-left: 500px; margin-top: 100px; border:dashed 1px red; width:205px; height:230px;">
</div>
<form id="dataform" method="post" action="insert.php">
<output name="dataoutput" id="dataoutput" type="submit">
</output>
</form>
<div id="div3_example_result" style="height:20px; line-height:20px; margin:10px 0 0 0; border:dashed 1px #666;"></div>
</body>
</html>
and the part of php file is:
<?php
$result = mysql_query("SELECT * FROM Aktiviteti where Data= '$_POST[dataoutput]'");
if(!empty($result))
{
$row = mysql_fetch_row($result);
echo $row[0]; // 42
echo $row[1]; // the email value
echo $row[2]; // the email value
}
else
echo "Empty"
?>
and the line 16 is:
$result = mysql_query("SELECT * FROM Aktiviteti where Data= '$_POST[dataoutput]'");
Why does this happen? Can i make the form submit in output line:
<output name="dataoutput" id="dataoutput" type="submit">
Please help me? What can I do?