I am trying to create simple checkout system with PHP by using sessions.
I thought using sessions to store cart details on variables and after payment passing it to the MySQL database
checkout.php
<?php
session_start[size=2]color=#007700;[/size][/color]$product_name= “some value”;
[size=2]$product_price= “some value”;
session_registercolor=#007700;[/size][/color]
session_registercolor=#007700;[/size][/color]
echo(‘<A href=“https://www.nochex.com/nochex.dll/checkout?email=nochex@domain.com&amount=‘.$productprice.’&returnurl=http://www.domain.com/success.php”>Click here to pay with nochex</a>’);
?>
success.php
--------------------------------------
<?
$username=“username”;
$password=“password”;
$database=“your_database”;
mysql_connect(localhost,$username,$password);
@mysql_select_db($database) or die( “Unable to select database” );
session_startcolor=#007700;[/color]
$query = “INSERT INTO orders VALUES (‘’,$product_name,$product_price)”;
mysql_query($query);
echo(‘Thankyou for choosing our services. Your payment is recieved’);
?>
I need to know if i am doing everything correct.