“Skript in PHP” Code-Antworten

Skript in PHP

<?php
    if(isset($_POST['btn'])){
        //do some task
    ?>
    <script type="text/javascript">
        var e = document.getElementById('testForm'); e.action='test.php'; e.submit();</script>
    <?php
    }
    ?>
<form name="testForm" id="testForm"  method="POST"  >
    <input type="submit" name="btn" value="submit" autofocus  onclick="return true;"/>
 </form>
Grieving Gerbil

PHP -Skript


You may want to know that removing semicolon is optional sometime but need to know the condition when it can be removed and when it can't be.
-------------------------------------------------------------------------
// Example 1: PHP script with closing tag at the end.
<?php

// php code

// you can remove semicolon
mysqli_close( $db )
?>

// Example 2: PHP script without closing tag at the end.
<?php

// php code 

// you can't remove semicolon
mysqli_close( $db )

-----------------------------------------------------------------------

claude61340

Ähnliche Antworten wie “Skript in PHP”

Fragen ähnlich wie “Skript in PHP”

Weitere verwandte Antworten zu “Skript in PHP” auf PHP

Durchsuchen Sie beliebte Code-Antworten nach Sprache

Durchsuchen Sie andere Codesprachen