View Full Version : Passing variables between js and php

06-20-2005, 02:18 PM
Hey people. I'm new here, and I was wondering if anyone could help me. I have just started learning how to use PHP and JavaScript, and I wanted to assign a javascript variable to as php one. How can I go about this. Here is what I had tried but it isn't work. Can anyone help:

function viewStudy(id)
<? $_SESSION['studyID'] = "<script type='text/javascript'>=id;</script>" ?>;

var url = "http://www.onlinemia.com/worklist/worklist.php";
var win = window.open(url, 'mainFrame');
var url1 = "http://www.onlinemia.com/OnlineMIA_JavaWebStart.jnlp";
var win1 = window.open(url1);

06-20-2005, 04:22 PM
Javascript runs on the client. After the server is done with it. After PHP has run and finished.
If you want to use a JS variable, you need to initiate another GET or POST to the server with JS and pass the variable to PHP as a GET or POST parameter.