Hi Phuc,
I work around the problem and I fix the problem without the submit()
function.
It will dynamic update content in room by sending the sql_query to
server and get
info back.
thank for your response.
Nguyen Trong Phuc wrote:
>
> i think that u can't, b/c php is server side while JS is client site. u can
> doSubmit() when building is changed, then php script get infomation and
> response to browser.
>
> Trong Phuc
>
> ----- Original Message -----
> From: "Phieu Huynh" <[EMAIL PROTECTED]>
> Cc: <[EMAIL PROTECTED]>
> Sent: Sunday, November 11, 2001 4:31 PM
> Subject: pass variable in JS to php and mysql-query
>
> > <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 Huynh
> >
> >
--
Phieu (phil) Huynh
Computer System Officer
Monash University
Electrical & Computer Systems Engineering
Phone : +61 3 990 53469
---------------------------------------------------------------------
Before posting, please check:
http://www.mysql.com/manual.php (the manual)
http://lists.mysql.com/ (the list archive)
To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php