Re: Replace punctuation in an associative array
[email protected] (The Doctor) Fri, 14 Apr 2023 01:12:19 -0000 (UTC)
| Newsgroups | comp.lang.php |
|---|---|
| Organization | NetKnow News |
| Message-ID | <[email protected]> |
95% there.
Now I have split the form successfully I need to get
the cartitem in a printable format.
So given when I have worked on
<?=session_start();
error_reporting(E_ALL);
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1.0, user-scalable=no">
<link rel="stylesheet" type="text/css" href="css/css.css"/>
<link rel="stylesheet" type="text/css" href="css/css2.css"/>
</head>
<?php
if(!empty($_SESSION['sessiondata'])){
}
?>
<?php
$myObj = [];
$storevalues= array();
$cartarray= array();
$cart= array();
$contact1=array();
$contact_details=array();
$shipping1=array();
$shipping_details=array();
$billing1=array();
$billing_details=array();
$arr2 =array();
class Storevs{
}
class Item
{
}
class TaxItem
{
}
class CartItem
{
public $items;
public $subtotal;
public $tax;
};
class Contact
{
}
class Shipping
{
}
class Billing
{
}
$items_count = 0;
$newsubtotal = 0;
$subtotal = 0;
$arr = array();
if (isset($_POST["submit"])){
$storevalues=(array) $storev;
}
if (isset($_POST["submit"])){
$cartitem= new CartItem();
foreach ($_POST['quantity'] as $key => $value) {
if( $value > 0){
if(isset($_POST['with_gst'][$key])){
$unit_cost = 63.00;
}else{
$unit_cost = 60.00; //no gst included
}
$item = new Item();
$item->url = "https://image";
$item->description = $_POST['description'][$key];
$item->product_code = $_POST['id'][$key];
$item->unit_cost = $unit_cost;
$item->quantity = $value;
$cartitem->items[] = $item;
}
}
$cartitem->subtotal = ($_POST['charge_total']/1.05);
$taxItem = new TaxItem();
$taxItem->amount = (($_POST['charge_total']/1.05) * 0.05);
$taxItem->description = "GST";
$taxItem->rate = "5.00";
$cartitem->tax = $taxItem;
$cart= (array) $cartitem ;
$cartarray = array( "cart" => $cartitem);
}
if (isset($_POST["submit"])){
$contact=new Contact;
$contact1= (array) $contact ;
$contact_details=array ( "contact_details" => $contact1 );
}
if (isset($_POST["submit"])){
$shipping = new Shipping;
$shipping1 = (array) $shipping;
$shipping_details=array( "shipping_details" => $shipping1 );
}
if (isset($_POST["submit"])){
$billing = new Billing;
$billing_details=array( "billing_details" => $billing1 );
}
$_SESSION['arr'] = serialize($arr);
$_SESSION['serialized_Obj'] = serialize($myObj);
?>
<body>
<form action="https://www.nk.ca/pdsolutions/step5b.php" method="post" >
<h2> Please review your order!</h2>
<?php
echo "<br /><br />";
echo "<h3> Contact Information </h3>";
echo "<br /> My name is " . $contact->first_name . " " . $contact->last_name . "<br />";
echo "My E-mail address is " . $contact->email . " <br />";
echo "You can call me at " . $contact->phone . " <br /> <br />";
echo "<h3> Billing Information </h3>";
echo "<br /> Address :" . $billing->address_1 . "<br />";
echo $billing->address_2 . "<br />";
echo "Municipality:" . $billing->city . "<br />";
echo "Province:" . $billing->province . "<br />";
echo "Postal Code:" . $billing->postal_code . "<br /><br />";
echo "<h3> Shipping Information </h3>";
echo "<br /> Address :" . $shipping->address_1 . "<br />";
echo $shipping->address_2 . "<br />";
echo "Municipality:" . $shipping->city . "<br />";
echo "Province:" . $shipping->province . "<br />";
echo "Postal Code:" . $shipping->postal_code . "<br /><br />";
echo "<h3> Course Information </h3>";
?>
<input type="submit" value="Place Your Order" name="submit" id="submit" >
<input onclick="history.back()" type="reset" value="Clear the Form" id="reset" />
</form>
</body>
</html>
Excised only for the needed information.
The Course information is in the cart items.
How do I present to the customer what is in the cart / what
they are ordering?
--
Member - Liberal International This is [email protected] Ici [email protected]
Yahweh, King & country!Never Satan President Republic!Beware AntiChrist rising!
Look at Psalms 14 and 53 on Atheism https://www.empire.kred/ROOTNK?t=94a1f39b
She didn't want to be evil, but by denying her nature she adopted it. -unknown Beware https://mindspring.com