Posted by David Haynes on 07/13/06 23:35
Chuck Anderson wrote:
> David Haynes wrote:
>> Chuck Anderson wrote:
>>
>>> monomaniac21 wrote:
>>>
>>>> hi i want to be able to trigger a javascript style popup alert in php
>>>> (i want a message displayed on the actual page) is this possible?
>>>>
>>>>
>>> I'll take this one ... all I usually do here is ask questions.
>>>
>>> The answer to your question is No. Php is run on the *server before*
>>> the page is displayed. Therefore, Php cannot popup an alert like
>>> JavaScript (which runs on the *client computer after* the page is
>>> loaded).
>>>
>>> That said; if you want to implement a two step procedure like
>>>
>>> (1) Delete this file.
>>> (2) Are you Sure (Y or N)?
>>>
>>> You can do that with Php, but clicking on (1) must create a request
>>> to the server to display a new page with (2) as a form or hyperlinks.
>>> Clicking on Y or N must return to the server again in able to perform
>>> the action.
>>>
>>>
>> or you can have the php spit out the javascript as part of the page and
>> trigger it from the onclick= in the submit.
>>
>> -david-
> But that's not "triggered in Php" and is simply JavaScript.
>
Yes, but you had already provided "you can't get there from here"
answer. Sometimes it pays to offer alternatives rather than just to
answer the question someone has asked.
-david-
[Back to original message]
|