Re: Alter html variable contents

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, May 6, 2015 at 11:09 AM, Jeffry Killen <jekillen@xxxxxxxxxxx> wrote:

>
> On May 5, 2015, at 6:29 PM, Marcos Almeida Azevedo wrote:
>
>  On Mon, May 4, 2015 at 5:10 PM, Alf C Stockton <alf@xxxxxxxxxxxxxx>
>> wrote:
>>
>>  I already have
>>> <div id="loadingNode"></div> in my HTML
>>> and both the HTML and PHP are in the same file and I want loadingnode to
>>> be populated with the message produced by PHP after user clicked
>>> appropriate link.
>>>
>>>
>> I think what you needs is Javascript code and not PHP
>>
>
> with php:
> As I said,
>
>> <div id="loadingNode"><?php print <content>?></div>
>>>
>> Where <content> will be the result of the user clicking the
> link in the html. But the link has to point back to server side
> php code. If you don't want the link to point back to server side php
> you do need javascript. But what you want to place in the div must
> already be in the page somewhere as a javascript string or
> hidden input field.
> You can also have the link initiate an async AJAX call to the server
>

AJAX would be a very good choice. That will involve both client and server
side coding though


> to get the div contents. And again that requires calling server side
> php. Php does not run in the browser. Only javascript (or in the case
> of Internet Explorer: VBscript: and in all you can use Flash ActionScript
> in an SWF file). These client side scripting approaches are separate
> subjects and require a good understanding of how to use them.
> JK
>
>
>>
>>
>>>> On May 3, 2015, at 6:53 AM, Alf C Stockton wrote:
>>>>
>>>>  Please tell me if I can and if so how, to alter the contents of a
>>>>> html div
>>>>> from my PHP script.
>>>>>
>>>>>
>>>>> --
>>>>> Regards,
>>>>> Alf Stockton        www.stockton.co.za
>>>>>
>>>>>
>>>> The way I would do this is to have some element in your html
>>>> with an anchor tag with an href value set to your page
>>>>
>>>> LIke so
>>>> <?
>>>> $fileself = basename($_SERVER['PHP_SEF'])
>>>>
>>>> $div = "<div marup>";
>>>> if($_GET[do] == "changediv")
>>>>   {
>>>>  $div = "div markup changed";
>>>> }
>>>> ?>
>>>>
>>>>
>>>> <html>
>>>> etc
>>>> <body>
>>>>
>>>> <a href="<?php print $fileself; ?>?do=changediv">Change div</a>
>>>>
>>>> <?php print $div ?>
>>>>
>>>> </body>
>>>> </html>
>>>>
>>>> In this case the user has to click the anchor, or there
>>>> will have to be some more involved javascript processing
>>>> involved, like an ajax request sent, but it still requires an
>>>> action of the use to initiated.
>>>>
>>>>
>>>
>>> --
>>> Regards,
>>> Alf Stockton        www.stockton.co.za
>>>
>>>
>>> --
>>> PHP General Mailing List (http://www.php.net/)
>>> To unsubscribe, visit: http://www.php.net/unsub.php
>>>
>>>
>>>
>>
>> --
>> Marcos | I love PHP, Linux, and Java
>> <http://javadevnotes.com/java-string-split-limit-examples>
>>
>
>


-- 
Marcos | I love PHP, Linux, and Java
<http://javadevnotes.com/java-left-pad-string-with-zeros-examples>

[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux