How can you insert javascript in php code?

Answer Posted / webguy

Mukesh(watch out for syntax errors) and atanu are right.
VIvek seemed have misunderstood the question. It's more of
injecting JS code within PHP code segment like this:

<?php
echo "<script type='text/javascript'>";
echo "alert('jams bond');";
echo "</script>";
?>

OR

<?php
echo "<script type='text/javascript'>alert('jams
bond');</script>";
?>

Is This Answer Correct ?    24 Yes 8 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What are the uses of implode() function?

568


How to remove duplicate values from a PHP Array?

544


What is a session in php?

567


What are encryption functions in php?

544


How to get the directory name out of a file path name?

541






Is empty in excel?

529


What is a helper function?

541


What is difference between session_unset and session_destroy?

504


What language is php based on?

490


Why and where do we use htaccess?

528


What is the use of ajax in php?

514


How big is varchar max?

590


How many keywords are there in php?

617


What is php how it works?

534


What is a stored procedure in mysql?

531