I have adjusted a lot of the code that I posted earlier but nothing seems to work, I put in the code to show all errors and I am not getting any errors returened after I fixed the single minor misstype of adding an extra "(" into the code, i am now faceing a completely blank div with no ideas left as to where to even start looking for the problem
<?php
error_reporting(E_ALL);
ini_set('display_errors', 1);
include 'conect.php';
$deets = $_POST['deets'];
$deets = preg_replace('#[^0-9/]#i', '', $deets);
$events = '';
$query = mysql_query('SELECT description FROM events WHERE date = "'. $deets .'"');
$num_rows = mysql_num_rows($query);
if($num_rows > 0)
{
$events .= '<div id = "eventsControl"><button onClick = "overlay()">Close</button><br /><br /><b>' . $deets . '</b><br /><br /></div>';
while($row = mysql_fetch_array($query))
{
$desc = $row['description'];
$events .= '<div id = "eventsBody">' . $desc . '<br /><hr><br /></div>';
}
}
echo $events;
?>
this is the events.php, this is not comunicating properly with the show_details function in my show_calendar.php
function show_details(theId)
{
var deets = (theId.id);
e1 = document.getElementById("overlay");
e1.style.display = (e1.style.display == "block") ? "none" : "block";
e1 = document.getElementById("events");
e1.style.display = (e1.style.display == "block") ? "none" : "block";
var hr = new XMLHttpRequest();
var url = "events.php";
var vars = "deets=" + deets;
hr.open("POST", url, true);
hr.setRequestHeader("content-type", "application/x-www-form-urlencoded");
hr.onreadystatechange = function()
{
if(hr.readyState == 4 && hr.status == 200)
{
var return_data = hr.responseText;
document.getElementById("events").innerHTML = return_data;
}
}
hr.send(vars);
document.getElementById("events").innerHTML = "Processing...";
}
can anyone please spot what i am missing? these two are suposed to be comunicating and for some reason they arent. i will post also the code that calls the show_details()
for($i = 1; $i <= $day_count; $i++)
{
$date = $showMonth . '/' . $i . '/' . $showYear;
$query = mysql_query('SELECT id FROM events WHERE date = "'.$date.'"');
$num_rows = mysql_num_rows($query);
if($num_rows > 0)
{
$event = "<input name = '$date' type = 'submit' value = 'Details' id = '$date' onClick = 'javascript:show_details(this);'>";
}
echo '<div class = "cal_day">';
echo '<div class = "day_heading">' . $i . '</div>';
if($num_rows != 0)
{
echo "<div class = 'openings'><br />" . $event . "</div>";
}
echo '</div>';
}