How to pass SESSION values to table ?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • aveeva
    New Member
    • Apr 2019
    • 33

    How to pass SESSION values to table ?

    I am under developing PHP add to cart without DB, so that i am using SESSION, actually get data from fetch_data.php data to my_cart.php using the POST method, successfully retun the values,

    After receiving the post data how can i convert to display like a table.



    workout:



    fetch_data.php return values.

    https://snag.gy/IASCMZ.jpg

    & values received

    https://snag.gy/ojWxHe.jpg

    Here is my my_cart.php :

    Code:
    // FYI -> Here i am using only two fields :  voice_sku & voice_name 
    
    <table width="100%" cellpadding="6" cellspacing="0">
     <thead>
     <tr>
     <th>Voice Sku</th>
     <th>Voice Name</th>
     <th>Remove</th>
     </tr>
     </thead>
    
     <tbody>
    
     <?php
     session_start();
     $voice_sku = '';
     $voice_name = '';
    
     if(isset($_POST['voice_sku'])&& isset($_POST['voice_name']))
                {
     // print_r($_POST);
     // die();
     
     $voice_sku = $_POST['voice_sku'];
     $voice_name = $_POST['voice_name'];
     $_SESSION['voice_sku'] = $voice_sku;
     $_SESSION['voice_name'] = $voice_name;
     
     
                }   
     var_dump($_SESSION);    
     ?>
    
     <tr>
     <td colspan="5">
     <span style="float:right;text-align: right;">
     <!--  -->
     </span>
     </td>
     </tr>
     <tr>
     <td colspan="5">
     <a href="index.php" class="button">Add More Items</a>
     <button type="submit">Update</button>
     </td>
     </tr>
    
     </tbody>
    </table>
Working...