Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to add script inside a php code?

Tags:

How can I add script inside a php code? suppose i want to give an alert for a button click.. how can i do that??

like image 414
champ Avatar asked Aug 24 '10 12:08

champ


People also ask

Can you use JavaScript and PHP together?

Besides, PHP and JavaScript similarities, these two languages are a powerful combination when used together. Large numbers of websites combine PHP and JavaScript – JavaScript for front-end and PHP for back-end as they offer much community support, various libraries, as well as a vast codebase of frameworks.

How can you display text with a PHP script?

PHP allows us to display the text in various formats using various inbuilt methods. Using echo command: The echo command can be used to display text, including numerical, strings and arrays.

HOW include HTML in PHP?

Use PRINT or ECHO With this method, you can include the HTML inside of the PHP tags. This is a good method to use for adding HTML to PHP if you only have a line or so to do. "<i>Print works too!


1 Answers

You can just echo all the HTML as normal:

<?php    echo '<input type="button" onclick="alert(\'Clicky!\')"/>'; ?> 
like image 65
Pat Avatar answered Sep 28 '22 11:09

Pat