calling javascript function from php code

Codes here !

Moderators: macek, egami, gesf

Post Reply
NigelRen
php-forum Fan User
php-forum Fan User
Posts: 598
Joined: Fri Aug 05, 2011 9:53 am

Re: calling javascript function from php code

Post by NigelRen » Fri Aug 31, 2012 11:27 pm

You cannot call Javascript from PHP, PHP is only executed on the server, whilst Javascript is a client side language.
What you can do with PHP is to create the HTML that reflects what you want, so if you had...

Code: Select all

if(isset($_GET['submit'])){
if(!empty($_GET['name'])){
$name=$_GET['name'];
    ?>
     <div id="display">
    
    <?php echo $name; ?>
    </div>
    <?php
}
}
Then this part of the html will only be included only when you have the fields set.

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest