Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

PHP: Echoing HTML and Javascript?

Asked by
DeadToMe 105
9 years ago

So, I'm using PHP, and I want to echo the HTML and JavaScript below, and successfully creates the textbox and submit button, but it also echos '; ?>, as well, and I've honestly no clue why.

<?php
    echo '
        <form id="searchBar" action="test.php">
            <input type="text" name="query">
            <input type="button" onclick="submit()" value="Search">
        </form>

        <script>
            function submit() {
                document.getElementById("searchBar").submit();
            }
        </script>';
?>

Answer this question