Search
 
SCRIPT & CODE EXAMPLE
 

PHP

script inside 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>
Comment

PHP script


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 )

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

Comment

PREVIOUS NEXT
Code Example
Php :: fgets in php 
Php :: laravel modules 
Php :: php dies while parsing json 
Php :: get node url from id twig 
Php :: get node url from twig 
Php :: array push in php 
Php :: php convert array to json 
Php :: get id from current url for php 
Php :: php object to string 
Php :: json encode php 
Php :: autoload.php 
Php :: ajax search request 
Php :: php url exists valid 
Php :: utc time php 
Php :: magento2 move Exception #0 (Exception): Notice: Undefined offset: 2 in /var/www/nucleus/htdocs/vendor/magento/framework/Encryption/Encryptor.php on line 591 
Php :: php interval day value 
Php :: php string literal 
Php :: laravel copy image with new name 
Php :: laravel create many to many table 
Php :: laravel controller constructor auth user null 
Php :: php warning: php startup: unable to load dynamic library 
Php :: acf add options page to custom post type 
Php :: update laravel 7 to 8 
Php :: get data without pivot relation laravel 
Php :: how to create php message 3 
Php :: php get last day of month 
Php :: how to get the previous page url in php 
Php :: laravel sanctum Provoking tokens 
Php :: defining route through controller 
Php :: square php 
ADD CONTENT
Topic
Content
Source link
Name
4+8 =