[PHP] Re: pass javascript variable to php without submit or reload
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 [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED]... 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) option1/option option2/option option3/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 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Re: pass javascript variable to php?
A. Dixon wrote: So say I have a link on the page that the checkbox is on to a file called program.php How would I add name value pairs to the querystring when someone clicks on the checkbox? Then when I click on the link program.php it should read program.php?checkbox1=on where checkbox1 is the name of the checkbox that is selected. When you can use JavaScript, you can set/get any query string with location object and can make a new request with the query string. You can catch any event that JavaScript supports including click at checkbox,etc, to change query string, to make a new request, etc. Try to take a look at JavaScript book/reference, you'll see how it can be done :) -- Yasuo Ohgaki Thanks, Aaron On Thu, 8 Nov 2001, Yasuo Ohgaki wrote: Aaron wrote: I've got checkbox that I get the status of with javascript and I put the status into a javascript variable. How do I get that variable over to php? I don't want to hit the submit button to get the variable into php. Use query string or cookie. Just becareful with cookie isn't on always and has limitations. You cannot use too large query string also. _ Do You Yahoo!? Get your free @yahoo.com address at http://mail.yahoo.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]