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 :: php: foreach loop 
Php :: wordpress wpdb delete 
Php :: base64_decode 
Php :: php order array by specific key 
Php :: login php 
Php :: laravel migration add column first 
Php :: laravel run controller from command line 
Php :: php if equal 
Php :: create custom rule in laravel 
Php :: product slider shortcode woocommerce 
Php :: laravel validation 
Php :: $this 
Php :: Turn error log WP 
Php :: serialise php 
Php :: php get final redirect url 
Php :: use php-fpm with apache 
Java :: java get screen size 
Java :: camera permission android 
Java :: The package java.awt.event is not accessible 
Java :: circular imageview android 
Java :: java integer to binary string with leading zeros 
Java :: Cannot resolve class android.support.design.widget.AppBarLayout 
Java :: how to generate random numbers in java within range 
Java :: error: cannot find symbol@javax.annotation.Generated( 
Java :: java create a set with values 
Java :: maven source option 5 is no longer supported use 7 or later 
Java :: java ip regex pattern 
Java :: javafx icon button 
Java :: Duplicate class com.google.common.util.concurrent.ListenableFuture found in modules jetified-guava-24.1-jre (com.google.guava:guava:24.1-jre) and jetified-listenablefuture-1.0 (com.google.guava:listenablefuture:1.0) 
Java :: how to randomize an array java 
ADD CONTENT
Topic
Content
Source link
Name
7+8 =