X9183 Posted March 30, 2008 Share Posted March 30, 2008 HELP !!!! - My PHP script uses a PHP INCLUDE which brings in a JAVASCRIPT that is working fine. My problem is I cannot convert the JAVASCRIPT variables to PHP. I also use SESSIONS in place of COOKIES. IF anybody knows of a simple solution and if possible with a few coding examples I'd be most grateful??? Quote Link to comment Share on other sites More sharing options...
Psycho Posted March 31, 2008 Share Posted March 31, 2008 I cannot convert the JAVASCRIPT variables to PHP. What is that supposed to mean? Can you provide some code of what you have and explain what you are trying to do? Quote Link to comment Share on other sites More sharing options...
X9183 Posted April 18, 2008 Author Share Posted April 18, 2008 Sorry it has taken a while. As you see everything is in order until I get to the "form method= " and there I just do not know where to go it more accurate to confess that I am confused. Any sample code showing the link between Client and Server, explaining it to a kindergarten student would be gratefully appreciated. <?PHP SESSION_START(); ob_start(); $self = $_SERVER['PHP_SELF']; $referer = $_SERVER['HTTP_REFERER']; ?> <html><head><title>time test</title> <script language="JavaScript" type="text/javascript"> // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ function displaydate() { var date = new Date(); var d = date.getDate(); var day = (d < 10) ? '0' + d : d; var m = date.getMonth() + 1; var month = (m < 10) ? '0' + m : m; var yy = date.getYear(); var year = (yy < 1000) ? yy + 1900 : yy; var hours = date.getHours(); var minutes = date.getMinutes(); var seconds = date.getSeconds(); if (minutes < 10) minutes = "0" + minutes; if (seconds < 10) seconds = "0" + seconds; var datum = (year + "/" + month + "/" + day + ' - '+hours+':'+minutes+':'+seconds); document.displaydate.clientdate.value=datum; } // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ function writedate() { var date = new Date(); var d = date.getDate(); var day = (d < 10) ? '0' + d : d; var m = date.getMonth() + 1; var month = (m < 10) ? '0' + m : m; var yy = date.getYear(); var year = (yy < 1000) ? yy + 1900 : yy; var hours = date.getHours(); var minutes = date.getMinutes(); var seconds = date.getSeconds(); if (minutes < 10) minutes = "0" + minutes; if (seconds < 10) seconds = "0" + seconds; var yyyymmdd = (year + "-" + month + "-" + day + ' ~ '+hours+':'+minutes+':'+seconds); document.writedate.klientdate.value=yyyymmdd; } // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ </script></head> <body> <!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ --> <form method="post" action="" name="displaydate"> Display Date: <input type="text" name="clientdate" value="" size=21></form> <script>displaydate()</script> <!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ --> <form method="post" action="" name="writedate"> <input type="hidden" name="klientdate" value="" size=21></form> <script>writedate()</script> </body></html> :'( Quote Link to comment Share on other sites More sharing options...
RichardRotterdam Posted April 19, 2008 Share Posted April 19, 2008 Could you explain exactly what you are trying to do. Javascript runs only in your browser. php on your server Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.