By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
426,045 Members | 1,760 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 426,045 IT Pros & Developers. It's quick & easy.

How to pass SESSION values to table ?

aveeva
P: 27
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 :

Expand|Select|Wrap|Line Numbers
  1. // FYI -> Here i am using only two fields :  voice_sku & voice_name 
  2.  
  3. <table width="100%" cellpadding="6" cellspacing="0">
  4.  <thead>
  5.  <tr>
  6.  <th>Voice Sku</th>
  7.  <th>Voice Name</th>
  8.  <th>Remove</th>
  9.  </tr>
  10.  </thead>
  11.  
  12.  <tbody>
  13.  
  14.  <?php
  15.  session_start();
  16.  $voice_sku = '';
  17.  $voice_name = '';
  18.  
  19.  if(isset($_POST['voice_sku'])&& isset($_POST['voice_name']))
  20.             {
  21.  // print_r($_POST);
  22.  // die();
  23.  
  24.  $voice_sku = $_POST['voice_sku'];
  25.  $voice_name = $_POST['voice_name'];
  26.  $_SESSION['voice_sku'] = $voice_sku;
  27.  $_SESSION['voice_name'] = $voice_name;
  28.  
  29.  
  30.             }   
  31.  var_dump($_SESSION);    
  32.  ?>
  33.  
  34.  <tr>
  35.  <td colspan="5">
  36.  <span style="float:right;text-align: right;">
  37.  <!--  -->
  38.  </span>
  39.  </td>
  40.  </tr>
  41.  <tr>
  42.  <td colspan="5">
  43.  <a href="index.php" class="button">Add More Items</a>
  44.  <button type="submit">Update</button>
  45.  </td>
  46.  </tr>
  47.  
  48.  </tbody>
  49. </table>
  50.  
1 Week Ago #1
Share this question for a faster answer!
Share on Google+

Post your reply

Sign in to post your reply or Sign up for a free account.