Re: pass javascript variable to php without submit or reload

From: Date: Mon, 12 Nov 2001 15:15:04 +0000
Subject: Re: pass javascript variable to php without submit or reload
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-74291@lists.php.net to get a copy of this message
If you are trying to collect things like monitor size or other user data you could try putting the JS in the head and then put a <meta refresh> tag with time period of 0. I haven't actually tried this but it might work. -- Mike ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ MICHAEL R. HARVEY <Sculptor> Web Creation - http://vestudiohost.com Internet Business Tools - http://ibiz-tools.com Sculpture, Craft, Jewelry - http://sculpture-by-mrh.com http://jewelry-by-mrh.com http://craft-by-mrh.com New Product Innovations and Development. Ph: 845-279-8295 "Phieu Huynh" <Phil.Huynh@eng.monash.edu.au> wrote in message news:3BEF120B.F6A9089C@eng.monash.edu.au... > > <script language=javascript> > function changebuilding (which) { > sel_var = which.selectedIndex > <? > $sql_query = "select distinct room > from general.room_info > where building='$variable' group by level asc"; > > $sql_result = mysql_query($sql_query) or die (" Can't execute the > query"); > > $i=0; > while ($row = mysql_fetch_array($result_sec_level)) > print ("ar[".$i++."] = \"".$row[0]."\";\n"); > ?> > for (i=0; i < ar.length; i++) { > option = new Option(ar[i]) > document.myform.room.options[i]=option > } > } > </script> > <body> > <form name=myform> > Building : <select name=building onchange=changebuilding(this) > > <option>1</option> > <option>2</option> > <option>3</option> > </select> > Room : <select name=room > > </select> > </form> > </body> > > > I can pass the variable in building to $variable by submit button > but I want to pass the sel_var variable to $variable and dynamic update > the content in room. > > -- > > phil

« previous php.general (#74291) next »