[PHP] Re: passing a variable value of PHP into the alert of JavaScript.

2004-03-30 Thread Jason Barnett
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


Re: [PHP] Re: passing a variable value of PHP into the alert of JavaScript.

2004-03-30 Thread Prabu Subroto
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 a Onclick='warning()'CustID/a;
- 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



Re[2]: [PHP] Re: passing a variable value of PHP into the alert of JavaScript.

2004-03-30 Thread Richard Davey
Hello Prabu,

Tuesday, March 30, 2004, 3:18:09 PM, you wrote:

PS Can I call a function of PHP code from HTML tag just the same
PS as I call a function of JavaScript from HTML tag?
PS I meant, Like this a Onclick='warning()'CustID/a;

No, but it'd be lovely if you could :)

(Actually the .NET framework allows this via some clever JS and page
segment caching, but I'm not sure of a PHP equivalent yet).

-- 
Best regards,
 Richard Davey
 http://www.phpcommunity.org/wiki/296.html

-- 
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

2004-03-30 Thread Jason Barnett
Prabu Subroto wrote:

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 a Onclick='warning()'CustID/a;
Well, what do you mean exactly?  If your file is a php file you can do 
something like do something like:

html
?php print warning($CustID); ?
/html
And this would print the return value from the warning() function.  But 
are you trying to call PHP scripts on the client side?  As far as I know 
you can't really do that without sending another request to the server. 
 You could emulate this, if you wanted to, doing something like:

?php
if (1 == $_REQUEST['warning']) {
warning($CustID);
}
?
a href=?php $_SERVER['PHP_SELF'] . '?warning=1'; ?CustID/a
If you want to implement an MVC controller you might check out the PEAR 
package HTML_QuickForm, it offers PHP error checking with support for 
JavaScript error messages.

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php