wojodesign / simplecart-js

A simple javascript shopping cart that easily integrates with your current website.
simplecartjs.org
1.79k stars 492 forks source link

How to get variables in PHP? #266

Open nearweb opened 12 years ago

nearweb commented 12 years ago

Hi, anyone know how to extrapolate data like item-name, item-price ecc in PHP due to send an mail to the customer with the resume or save data in db???

brettwejrowski commented 12 years ago

This will show you all the values posted to the checkout script, or you can use element inspector

print_r( $_POST );
drivebass commented 11 years ago

nearweb maybe this will help you? #323

DahmaniAdame commented 11 years ago

If you know your way around php, you can simply your $_POST to send Simple Cart array and then link each part into a php variable.

<?php
$content = $_POST;
for($i=1; $i < $content['itemCount'] + 1; $i++) {
  $name = 'item_name_'.$i;
  $quantity =  'item_quantity_'.$i;
  $price = 'item_price_'.$i;
  $total = $content[$quantity]*$content[$price];
}
?>
chikitsakgupta commented 11 years ago

grate work! , and i want ask one questio that is this possible to add hidden fields in form contaning store data i.e payment mode etc and ,the value of those hidden fields through php goes to visitors email in body alongwith my message like a notification email ,

actuaaly i manged to do this , i am getting email with the visitors data , but visitors are getting onlymy message and the values of hidden fields are not displayed in visitors email , i dont know where i am missing , please help gygs

you can look at my form and php at this link

http:// pastebin.com/eXcUMBVc