PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
I tried searching the forum, but came up with nothing.
Ok, basically, i have this code that takes the time in javascript and makes it a php variable. i have that all working, now what i want to do is be able to use that time variable and manipulate it like a regular integer variable.
<?php
$time = "<script language='javascript'>
d = new Date();
hr= d.getHours();
document.writeln(hr);
</script>"; ?>
this is your time<br>
<?php echo $time; ?>
<?php
$time2 = intval($time );
$hour = $time3 * 2;
?>
<br>this is the hour<br>
<?php echo $hour; ?>
Doing an intval() doesn't work for some reason. Maybe its because the variably actually consists of javascript code. Anyway, si there anyway to make a new variable with only what the java script writes out instead of the whole script?
Ok, now i understand thatit can't be done because php is a server side script. and java script is parsed ni the browser.
However, is there any way to do this using redirects? That would still be very useful.
i split the day up into 6 parts, so if its noon, you'll be in part 4, and if its midnight, you'll be in part 1. the others fall inbetween. Try changing you clock around on your computer.