Re: Alter html variable contents

From: Date: Mon, 04 May 2015 09:10:42 +0000
Subject: Re: Alter html variable contents
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-324860@lists.php.net to get a copy of this message
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. > > 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

« previous php.general (#324860) next »