How to insert PHP code between javascript code?
Posted: Thu Jan 22, 2009 1:29 am
Hey Guys,
Currently I already have a calender generated by javascript which display days and months and i already make each day displayed could be link to another page once the day been clicked.
My problem is, I wanted to include php code inside the generated javascript calender which read the sql database on which day is already full booked. If the respective day is already fully book, i want the day to display "FULL" on the calender right below the day displayed.
I do understand that javascript only runs on the client-side environment while php runs on the server-side environment. But, is there any way that i could make this happen?
Consider this is my code
<script: javascript>
.... calender js code
.... calender js code
.... calender js code
.....calender js code
....
<?php
$date = "'+Day_Counter+'Label_Month[Month]'+'Year+'"; /// Code from javascript
$check =mysql_query("SELECT * FROM appointment WHERE date=$date");
$cheking = mysql_num_rows($check);
if( $checking >= 18 ) {
echo "FULL";
}
?>
...... calender js code
...... calender js code
...... calender js code
...... calender js code
...... calender js code
</script>
Currently I already have a calender generated by javascript which display days and months and i already make each day displayed could be link to another page once the day been clicked.
My problem is, I wanted to include php code inside the generated javascript calender which read the sql database on which day is already full booked. If the respective day is already fully book, i want the day to display "FULL" on the calender right below the day displayed.
I do understand that javascript only runs on the client-side environment while php runs on the server-side environment. But, is there any way that i could make this happen?
Consider this is my code
<script: javascript>
.... calender js code
.... calender js code
.... calender js code
.....calender js code
....
<?php
$date = "'+Day_Counter+'Label_Month[Month]'+'Year+'"; /// Code from javascript
$check =mysql_query("SELECT * FROM appointment WHERE date=$date");
$cheking = mysql_num_rows($check);
if( $checking >= 18 ) {
echo "FULL";
}
?>
...... calender js code
...... calender js code
...... calender js code
...... calender js code
...... calender js code
</script>