0

Possible Duplicate:
Access a JavaScript variable from PHP

Let's say I have the following javascript:

<script>
    var today = new Date();
    var dd = today.getDate();
    var mm = today.getMonth()+1; //January is 0!

    var yyyy = today.getFullYear();
    if(dd<10){dd='0'+dd} if(mm<10){mm='0'+mm} today = mm+'/'+dd+'/'+yyyy;
</script>

Now I want to get the value of today variable into PHP.

$cur_date = '<script type="text/javascript"> document.write(today) </script>';

echo "current date: $cur_date";

$checkin = strtotime($cur_date);

Although I can output the current date but how can I transfer it to $checkin variable with strtotime function?

1

1 Answer 1

2

PHP runs before the page is sent to the browser. It is impossible in the way you want to do it.

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.