Ok...maybe not that hard.
I kinda understand that JS is client side and Php is server side...and in my googling i found a solution that many people suggest...I just cant seem to wrap my head around it...
you could also refresh the page with the variable in the url like:
url.php?scr_w_php=whatever
then access the variable:
echo $_REQUEST['scr_w_php'];
Thats what they all say...but what does it mean/how does it work?
For example. I have a javascript function that is trigged by an onclick:
<label id="<?php echo $dateCheck;?>" onclick="test(this.id)"><?php echo $dateCheck;?></label><br/>
so when it is clicked, the javascript function will have a parameter of...say...2009-05-03.
I want to set $Date to be THAT VALUE (the one passed in to javascript)
Right now just as a test I have:
<script type="text/javascript">
function test(date){
<?php
$query = "SELECT * FROM `pdem_timesheet`.`tblTimesheet`";
$result = mysql_query($query) or die("QUERY 1 ERROR");
$Date= mysql_result($result,0,"Date");
?>
document.write("<?PHP echo $FirstDay;?>");
}
</script>
like i said, purely a test to see if I can run a query once the JS function is called. (an i can, to my surprise )
SO yeah. i need to do $Date = Date;...how do i do that...possibly using the code up above? (i need that explained please) or ajax or what ever solution you have.
Thanks