Re: Passing the value of a variable from PHP to JavaScript.

From: Date: Fri, 27 Feb 2004 09:19:21 +0000
Subject: Re: Passing the value of a variable from PHP to JavaScript.
Groups: php.general 
Request: Send a blank email to php-general+get-178992@lists.php.net to get a copy of this message
Dear my friend, Gareth... Yes, it works....Thank you very much for your help. I really appreciate your help. Thanks ----- Original Message ----- From: Gareth Williams <gareth@venditor.com> Date: Fri, 27 Feb 2004 10:08:21 +0100 To: "Prabu Subroto" <prabusubroto@operamail.com> Subject: Re: [PHP] Passing the value of a variable from PHP to JavaScript. > Try this: > > > function tes(selCtrl){ > > document.write('<p>JavaScript</p>'); > > > > window.location.replace('http://192.168.23.1/coba/coba.php? > > vtes='+selCtrl.value); > > > > } > > <select onchange='tes(this)' name='vtes'> > > or this: > > > function tes(){ > selCtrl = document.getElementById('vtes'); > > document.write('<p>JavaScript</p>'); > > > > window.location.replace('http://192.168.23.1/coba/coba.php? > > vtes='+selCtrl.value); > > > > } > > <select onchange='tes(this)' name='vtes' id="vtes"> > > > > On 27 Feb 2004, at 10:00, Prabu Subroto wrote: > > > Dear my friends... > > > > I have my code like this : > > ====== > > <?php > > echo " > > <html> > > <script language='JavaScript'> > > function tes(){ > > document.write('<p>JavaScript</p>'); > > > > window.location.replace('http://192.168.23.1/coba/coba.php? > > vtes=$vtes'); > > > > } > > </script> > > <body> > > "; > > > > echo "diforward ke javascript"; > > > > echo " > > <select onchange='tes()' name='vtes'> > > <option value=''></option> > > <option value='1'>1</option> > > <option value='2'>2</option> > > </select> > > "; > > ?> > > </body> > > </html> > > ====== > > > > I expect this result on url column of my internet browser: > > " > > http://192.168.23.1/coba/coba.php?vtes='1' > > " > > or > > " > > http://192.168.23.1/coba/coba.php?vtes='1' > > " > > > > But I only get this unexpected result: > > " > > http://192.168.23.1/coba/coba.php?vtes= > > " > > > > Lookslike the value of "$vtes" was not passed to JavaScript > > interpreter. > > > > Anybody of you have a solution for me? > > > > Please teach me. > > > > Thank you very much. > > -- > > _____________________________________________________________ > > Web-based SMS services available at > > http://www.operamail.com. > >> From your mailbox to local or overseas cell phones. > > > > Powered by Outblaze > > > > -- > > PHP General Mailing List (http://www.php.net/) > > To unsubscribe, visit: http://www.php.net/unsub.php > > > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > -- _____________________________________________________________ Web-based SMS services available at http://www.operamail.com. From your mailbox to local or overseas cell phones. Powered by Outblaze

« previous php.general (#178992) next »