[PHP] Passing the value of a variable from PHP to JavaScript.
Dear my friends... I have my code like this : == function tes(){ document.write('JavaScript
'); window.location.replace('http://192.168.23.1/coba/coba.php?vtes=$vtes'); } "; echo "diforward ke javascript"; echo " 1 2 "; ?> == 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
Re: [PHP] Passing the value of a variable from PHP to JavaScript.
Dear my friend, Gareth... Yes, it worksThank you very much for your help. I really appreciate your help. Thanks - Original Message - From: Gareth Williams <[EMAIL PROTECTED]> Date: Fri, 27 Feb 2004 10:08:21 +0100 To: "Prabu Subroto" <[EMAIL PROTECTED]> Subject: Re: [PHP] Passing the value of a variable from PHP to JavaScript. > Try this: > > > function tes(selCtrl){ > > document.write('JavaScript'); > > window.location.replace('http://192.168.23.1/coba/coba.php? > > vtes='+selCtrl.value); > > > > } > > > > or this: > > > function tes(){ > selCtrl = document.getElementById('vtes'); > > document.write('JavaScript'); > > window.location.replace('http://192.168.23.1/coba/coba.php? > > vtes='+selCtrl.value); > > > > } > > > > > > On 27 Feb 2004, at 10:00, Prabu Subroto wrote: > > > Dear my friends... > > > > I have my code like this : > > == > > > echo " > > > > > > function tes(){ > > document.write('<p>JavaScript</p>'); > > window.location.replace('<a href="http://192.168.23.1/coba/coba.php">http://192.168.23.1/coba/coba.php</a>? > > vtes=$vtes'); > > > > } > > > > > > "; > > > > echo "diforward ke javascript"; > > > > echo " > > > > > > 1 > > 2 > > > > "; > > ?> > > > > > > == > > > > 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 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] passing a variable value of PHP into the alert of JavaScript.
Dear my friends... I want to make an alert which can display a value from the database. I am meaning : how can I pass a value of a variable from PHP into JavaScript alert ( alert("$Firstname, $LastName and $Address"); Is it possible? -- _ 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
Re: [PHP] Re: passing a variable value of PHP into the alert of JavaScript.
Akh... thank you my friend It's solved. May I ask another question? Can I call a function of PHP code from HTML tag just the same as I call a function of JavaScript from HTML tag? I meant, Like this "CustID"; - Original Message - From: Jason Barnett <[EMAIL PROTECTED]> Date: Tue, 30 Mar 2004 08:32:38 -0500 To: [EMAIL PROTECTED] Subject: [PHP] Re: passing a variable value of PHP into the alert of JavaScript. > Prabu Subroto wrote: > > Dear my friends... > > > > I want to make an alert which can display a value from the database. > > I am meaning : > > how can I pass a value of a variable from PHP into JavaScript alert ( > > alert("$Firstname, $LastName and $Address"); > > > > Is it possible? > > Sure. Probably the easiest way I can think to do it would be to create > the JavaScript function as a string and insert your variables into that > string. Then print() the string. > > -- > 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 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php