View previous topic :: View next topic |
Author |
Message |
mtbiking -
Joined: 18 Mar 2004 Posts: 66
|
Posted: Mon Jan 03, 2005 8:29 am Post subject: Creating Shopping Cart |
|
|
Can someone give me some ifo on creating a shopping cart like the one paypal use.
like the paypal one but for my own server so on checkout it gose to paypal / whatever
addtocart.php?email=my@email.com&product=whatever&price=10
then it puts it on the page
and totals it up,
then at the bottom of the page a button that sends the total thing :)
if you can understand that thanks
if you give us any info or help thanks |
|
Back to top |
|
 |
GustavoDL -
Joined: 08 Jul 2004 Posts: 16 Location: Malaga (Spain)
|
Posted: Mon Jan 03, 2005 3:46 pm Post subject: safety |
|
|
I recommend you to use session variables on guarding shopping values
$_SESSION['name']=value;
when no longer necessary delete it with unset(variable); _________________ Think as WAN, act as LAN
Piensa en WAN, actua en LAN |
|
Back to top |
|
 |
mtbiking -
Joined: 18 Mar 2004 Posts: 66
|
Posted: Tue Jan 04, 2005 7:50 am Post subject: |
|
|
thanks for that i was going to use cookies but looking at php.net session sounds better
but how to add an item to the page and then another below that one |
|
Back to top |
|
 |
GustavoDL -
Joined: 08 Jul 2004 Posts: 16 Location: Malaga (Spain)
|
Posted: Thu Jan 20, 2005 1:41 pm Post subject: |
|
|
You can/should use arrays:
to asing values (it's only an example, $item is the total of items in this sample)
Code: |
for ($n=0;$n<$item;$n++){
$_SESSION['item'][]="item".$n;
}
|
Note that in PHP not asigned name/value to an array position (like in my example) is valid, PHP auto asigns the next value, so you can get all the content of an array in this way:
Code: |
for ($n=0;$n<count($_SESSION['item' ]);$n++){
echo $_SESSION['item'][$n]."<br>";
}
|
PHP it's more flexible than COBOL :-P _________________ Think as WAN, act as LAN
Piensa en WAN, actua en LAN |
|
Back to top |
|
 |
|