A PHP variable filled by javascript?
Posted: Wed Jun 01, 2005 12:30 am
Consider this line:
$W is an integer variable whose value is determined by the width of the viewer's screen. The only way I know of to get that width is javascript, and I have been trying for hours to find a way to put that value into the PHP variable from the javascript fucntion and it has defeated me. In this and other boards I find tons on how to transmit information from PHP to javascript, but I have found nothing on the reverse.
I've also tried not using a variable at all but a js function using document.write() and none of my several tries at that methodology has worked either. I am no expert on js, by any means, but I didn't think I was this stupid.
Perhaps this should have been in the client side forum. If so, please feel free to move it. I posted it here because I'm trying to work the solution into PHP code.
Can anyone point me in the right direction?
Code: Select all
print("div class='fbox' style='top: 60px; left: $Wpx'>");I've also tried not using a variable at all but a js function using document.write() and none of my several tries at that methodology has worked either. I am no expert on js, by any means, but I didn't think I was this stupid.
Perhaps this should have been in the client side forum. If so, please feel free to move it. I posted it here because I'm trying to work the solution into PHP code.
Can anyone point me in the right direction?