Can I get a javascript variable (day/date) able to be pulled into PHP as a PHP variable?
Main Topics
Browse All TopicsIs it possible to grab the client's time/date as a variable?
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
You could set it into a hidden field in a form, and retreve it after submission. But you can't assign it to a PHP-variable directly.
<form>
<input type="hidden" name="clientDate">
<script>
var theDate = new Date();
var theDate2 = theDate .getHours()+" "+theDate.getDate();
document.forms[0].clientDa
</script>
-----
Now, the field clientDate will have to format hh:dd where hh is the hour from 0 to 23 and dd is the date(1 to 31).
Then an option is to use a hidden frame
Like this:
<frameset rows="100%,*">
<frame src="blank.html">
<frame src="getDate.html">
</frameset>
the page blank.html is blank.
In getDate.html use this code
<html>
<head>
<script>
var theDate = new Date();
var theDate2 = theDate .getHours()+" "+theDate.getDate();
var url ="yourMainPage.html";
url+="?clientDate="+theDat
top.frames[0].location.hre
</script>
</head>
<body>
</body>
</html>
What's happening here?
First of all, the file getDate.html is hidden from the user, a blank page is the the only page showing at top and this is blank.
Behind the scenes in getDate.html, a date is created using Javascript, and getDate is setting the url for the top-frame. the date is added to that url as the variable clientDate(format hh:dd hour and day). Then in yourMainPage.html you could retreve the client date from the variable $clientDate.
Batalf
Business Accounts
Answer for Membership
by: datibbaWPosted on 2002-01-31 at 13:25:26ID: 6769831
Yes, but not with PHP. Client-side thingy's usually means javascript thingy's.