Tuesday

Get dynamic variable & print in PHP

In this tutorial we will see how to get N number of dynamic variables and print it using php. Each value is accessed using a for loop.

if(isset())
  •    It is used to check for null values
  •    $nos is no.of text fields generated,so for loop used to get values of generated fields.
  •    'c'.$i  ->  become c1 at 1st iteration and c2,c3,c4 ...and so on.

     <?php

            if(isset($_POST['nos']))
               $nos = $_POST['nos'];

            $techie=0;
            for($i=1;$i<= $nos;$i++)
                 {
                    $techie = $_POST['c'.$i] ;
                     echo "$techie";
    
                 }

        ?>




_________________________________________________________________________________

0 comments:

Post a Comment

Don't Forget To Join US Our Community
×
blogger