
July 11th, 2001, 02:35 PM
|
|
Embittered Cynic
|
|
Join Date: Jul 2001
Location: 38.97° N, 94.67° W
Posts: 11
Time spent in forums: < 1 sec
Reputation Power: 0
|
|
|
Re: passing values to javascript functions
Quote: Originally posted by smedcalf
How can I pass a value from a php page to a javascript function that calls a pop up window of another php page? Please keep reply in child like terms, thanks. |
 Here's an example:
<SCRIPT type="text/javascript">
function rand() {
// shows a random image (randomized at the server)
document.location = "<?php echo "$PHP_SELF?i=$rand" ?>"
}
</SCRIPT>
The document containing this is a .php file, if that's not obvious. This way, you can assign variables, or generate function calls or whatever using variables accessible to your PHP script. Just echo the PHP variables where you want them in your Javascript.
__________________
+++linear +++
PHP Security Questions? start here
|