Rocksolid Light

Welcome to RetroBBS

mail  files  register  newsreader  groups  login

Message-ID:  

Intel CPUs are not defective, they just act that way. -- Henry Spencer


devel / comp.lang.php / Re: Replace punctuation in an associative array

SubjectAuthor
* Re: Replace punctuation in an associative arrayThe Doctor
`* Re: Replace punctuation in an associative arrayThe Doctor
 `* Re: Replace punctuation in an associative arrayJ.O. Aho
  `* Re: Replace punctuation in an associative arrayThe Doctor
   `* Re: Replace punctuation in an associative arrayJ.O. Aho
    `* Re: Replace punctuation in an associative arrayJ.O. Aho
     `- Re: Replace punctuation in an associative arrayJ.O. Aho

1
Re: Replace punctuation in an associative array

<u0l3ip$1e4l$2@gallifrey.nk.ca>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=826&group=comp.lang.php#826

  copy link   Newsgroups: comp.lang.php
Path: i2pn2.org!i2pn.org!weretis.net!feeder6.news.weretis.net!news.nk.ca!.POSTED.doctor.nl2k.ab.ca!not-for-mail
From: doctor@doctor.nl2k.ab.ca (The Doctor)
Newsgroups: comp.lang.php
Subject: Re: Replace punctuation in an associative array
Date: Thu, 6 Apr 2023 00:26:01 -0000 (UTC)
Organization: NetKnow News
Message-ID: <u0l3ip$1e4l$2@gallifrey.nk.ca>
References: <ttq5np$i9r$50@gallifrey.nk.ca> <k6i39aFkhvjU1@mid.individual.net> <tu0lvb$1ph9$52@gallifrey.nk.ca> <k6shf2F8l9lU1@mid.individual.net>
Injection-Date: Thu, 6 Apr 2023 00:26:01 -0000 (UTC)
Injection-Info: gallifrey.nk.ca; posting-host="doctor.nl2k.ab.ca:204.209.81.1";
logging-data="47253"; mail-complaints-to="usenet@gallifrey.nk.ca"
X-Newsreader: trn 4.0-test77 (Sep 1, 2010)
Originator: doctor@doctor.nl2k.ab.ca (The Doctor)
 by: The Doctor - Thu, 6 Apr 2023 00:26 UTC

In article <k6shf2F8l9lU1@mid.individual.net>,
Arno Welzel <usenet@arnowelzel.de> wrote:
>The Doctor, 2023-03-05 00:58:
>
>[...]
>> Actually the class approach works better.
>>
>> Too bad Google does not pick that up
>> in their searches for JSON>
>
>Well - programming is about to *learn* how to do things and not about
>"look at Google if there is a solution for it".
>

Bureaucracy said they are doing the job, but the customer is not happy.

Can I create an intermediary state
so just just before the customer hits the pay button,
they are review what they are sending?

>
>--
>Arno Welzel
>https://arnowelzel.de
>

--
Member - Liberal International This is doctor@nk.ca Ici doctor@nk.ca
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
All words are devalued in the mouth of the liar. -unknown Beware https://mindspring.com

Re: Replace punctuation in an associative array

<u17ca8$pa9$26@gallifrey.nk.ca>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=828&group=comp.lang.php#828

  copy link   Newsgroups: comp.lang.php
Path: i2pn2.org!i2pn.org!weretis.net!feeder6.news.weretis.net!news.nk.ca!.POSTED.doctor.nl2k.ab.ca!not-for-mail
From: doctor@doctor.nl2k.ab.ca (The Doctor)
Newsgroups: comp.lang.php
Subject: Re: Replace punctuation in an associative array
Date: Wed, 12 Apr 2023 22:45:28 -0000 (UTC)
Organization: NetKnow News
Message-ID: <u17ca8$pa9$26@gallifrey.nk.ca>
References: <ttq5np$i9r$50@gallifrey.nk.ca> <tu0lvb$1ph9$52@gallifrey.nk.ca> <k6shf2F8l9lU1@mid.individual.net> <u0l3ip$1e4l$2@gallifrey.nk.ca>
Injection-Date: Wed, 12 Apr 2023 22:45:28 -0000 (UTC)
Injection-Info: gallifrey.nk.ca; posting-host="doctor.nl2k.ab.ca:204.209.81.1";
logging-data="25929"; mail-complaints-to="usenet@gallifrey.nk.ca"
X-Newsreader: trn 4.0-test77 (Sep 1, 2010)
Originator: doctor@doctor.nl2k.ab.ca (The Doctor)
 by: The Doctor - Wed, 12 Apr 2023 22:45 UTC

In article <u0l3ip$1e4l$2@gallifrey.nk.ca>,
The Doctor <doctor@doctor.nl2k.ab.ca> wrote:
>In article <k6shf2F8l9lU1@mid.individual.net>,
>Arno Welzel <usenet@arnowelzel.de> wrote:
>>The Doctor, 2023-03-05 00:58:
>>
>>[...]
>>> Actually the class approach works better.
>>>
>>> Too bad Google does not pick that up
>>> in their searches for JSON>
>>
>>Well - programming is about to *learn* how to do things and not about
>>"look at Google if there is a solution for it".
>>
>
>Bureaucracy said they are doing the job, but the customer is not happy.
>
>Can I create an intermediary state
>so just just before the customer hits the pay button,
>they are review what they are sending?
>

Try to pass a json from 1 form to another.

>>
>>--
>>Arno Welzel
>>https://arnowelzel.de
>>
>
>
>--
>Member - Liberal International This is doctor@nk.ca Ici doctor@nk.ca
>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
>All words are devalued in the mouth of the liar. -unknown Beware
>https://mindspring.com

--
Member - Liberal International This is doctor@nk.ca Ici doctor@nk.ca
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
They who demand you ignore the elephant in the room are not working with your best interests in mind. -unknown Beware https://mindspring.com

Re: Replace punctuation in an associative array

<k9pj11Fmrd5U2@mid.individual.net>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=831&group=comp.lang.php#831

  copy link   Newsgroups: comp.lang.php
Path: i2pn2.org!i2pn.org!weretis.net!feeder8.news.weretis.net!news.imp.ch!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail
From: user@example.net (J.O. Aho)
Newsgroups: comp.lang.php
Subject: Re: Replace punctuation in an associative array
Date: Thu, 13 Apr 2023 07:41:53 +0200
Lines: 33
Message-ID: <k9pj11Fmrd5U2@mid.individual.net>
References: <ttq5np$i9r$50@gallifrey.nk.ca> <tu0lvb$1ph9$52@gallifrey.nk.ca>
<k6shf2F8l9lU1@mid.individual.net> <u0l3ip$1e4l$2@gallifrey.nk.ca>
<u17ca8$pa9$26@gallifrey.nk.ca>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
X-Trace: individual.net XWTMDVguDznZMOLTKjuaGg91NxjyiZTawK89yXMc5L7/kFdba7
Cancel-Lock: sha1:3sdwUa7kkt+Tue0hxPH8PAr6joA=
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101
Thunderbird/102.9.1
Content-Language: en-US-large
In-Reply-To: <u17ca8$pa9$26@gallifrey.nk.ca>
 by: J.O. Aho - Thu, 13 Apr 2023 05:41 UTC

On 4/13/23 00:45, The Doctor wrote:
> In article <u0l3ip$1e4l$2@gallifrey.nk.ca>,
> The Doctor <doctor@doctor.nl2k.ab.ca> wrote:
>> In article <k6shf2F8l9lU1@mid.individual.net>,
>> Arno Welzel <usenet@arnowelzel.de> wrote:
>>> The Doctor, 2023-03-05 00:58:
>>>
>>> [...]
>>>> Actually the class approach works better.
>>>>
>>>> Too bad Google does not pick that up
>>>> in their searches for JSON>
>>>
>>> Well - programming is about to *learn* how to do things and not about
>>> "look at Google if there is a solution for it".
>>>
>>
>> Bureaucracy said they are doing the job, but the customer is not happy.
>>
>> Can I create an intermediary state
>> so just just before the customer hits the pay button,
>> they are review what they are sending?
>>
>
> Try to pass a json from 1 form to another.

This is why you have session cookies, no point of passing data from a
form to another.

--
//Aho

Re: Replace punctuation in an associative array

<u18q9f$qtb$29@gallifrey.nk.ca>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=833&group=comp.lang.php#833

  copy link   Newsgroups: comp.lang.php
Path: i2pn2.org!rocksolid2!news.neodome.net!weretis.net!feeder6.news.weretis.net!news.nk.ca!.POSTED.doctor.nl2k.ab.ca!not-for-mail
From: doctor@doctor.nl2k.ab.ca (The Doctor)
Newsgroups: comp.lang.php
Subject: Re: Replace punctuation in an associative array
Date: Thu, 13 Apr 2023 11:50:07 -0000 (UTC)
Organization: NetKnow News
Message-ID: <u18q9f$qtb$29@gallifrey.nk.ca>
References: <ttq5np$i9r$50@gallifrey.nk.ca> <u0l3ip$1e4l$2@gallifrey.nk.ca> <u17ca8$pa9$26@gallifrey.nk.ca> <k9pj11Fmrd5U2@mid.individual.net>
Injection-Date: Thu, 13 Apr 2023 11:50:07 -0000 (UTC)
Injection-Info: gallifrey.nk.ca; posting-host="doctor.nl2k.ab.ca:204.209.81.1";
logging-data="27563"; mail-complaints-to="usenet@gallifrey.nk.ca"
X-Newsreader: trn 4.0-test77 (Sep 1, 2010)
Originator: doctor@doctor.nl2k.ab.ca (The Doctor)
 by: The Doctor - Thu, 13 Apr 2023 11:50 UTC

In article <k9pj11Fmrd5U2@mid.individual.net>,
J.O. Aho <user@example.net> wrote:
>On 4/13/23 00:45, The Doctor wrote:
>> In article <u0l3ip$1e4l$2@gallifrey.nk.ca>,
>> The Doctor <doctor@doctor.nl2k.ab.ca> wrote:
>>> In article <k6shf2F8l9lU1@mid.individual.net>,
>>> Arno Welzel <usenet@arnowelzel.de> wrote:
>>>> The Doctor, 2023-03-05 00:58:
>>>>
>>>> [...]
>>>>> Actually the class approach works better.
>>>>>
>>>>> Too bad Google does not pick that up
>>>>> in their searches for JSON>
>>>>
>>>> Well - programming is about to *learn* how to do things and not about
>>>> "look at Google if there is a solution for it".
>>>>
>>>
>>> Bureaucracy said they are doing the job, but the customer is not happy.
>>>
>>> Can I create an intermediary state
>>> so just just before the customer hits the pay button,
>>> they are review what they are sending?
>>>
>>
>> Try to pass a json from 1 form to another.
>
>This is why you have session cookies, no point of passing data from a
>form to another.
>

I have

<?=session_start();
error_reporting(E_ALL);
?>

So I need to add a specific cookie/ token ?

>--
> //Aho
>
>

--
Member - Liberal International This is doctor@nk.ca Ici doctor@nk.ca
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
Giving can be overdone, as well as underdone. -unknown Beware https://mindspring.com

Re: Replace punctuation in an associative array

<k9qanbFqbf1U1@mid.individual.net>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=834&group=comp.lang.php#834

  copy link   Newsgroups: comp.lang.php
Path: i2pn2.org!i2pn.org!weretis.net!feeder8.news.weretis.net!news.imp.ch!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail
From: user@example.net (J.O. Aho)
Newsgroups: comp.lang.php
Subject: Re: Replace punctuation in an associative array
Date: Thu, 13 Apr 2023 14:26:19 +0200
Lines: 37
Message-ID: <k9qanbFqbf1U1@mid.individual.net>
References: <ttq5np$i9r$50@gallifrey.nk.ca> <u0l3ip$1e4l$2@gallifrey.nk.ca>
<u17ca8$pa9$26@gallifrey.nk.ca> <k9pj11Fmrd5U2@mid.individual.net>
<u18q9f$qtb$29@gallifrey.nk.ca>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
X-Trace: individual.net 7BQaouIAQcQJIuloW+yptgU0xxSyr6KrfG4OzfNofSw5XTLpJ9
Cancel-Lock: sha1:Pyg2pYDo82g4UEPNtugjAmX/2YI=
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101
Thunderbird/102.9.1
Content-Language: en-US-large
In-Reply-To: <u18q9f$qtb$29@gallifrey.nk.ca>
 by: J.O. Aho - Thu, 13 Apr 2023 12:26 UTC

On 4/13/23 13:50, The Doctor wrote:
> In article J.O. Aho <user@example.net> wrote:

>>> Try to pass a json from 1 form to another.
>>
>> This is why you have session cookies, no point of passing data from a
>> form to another.
>>
>
> I have
>
> <?=session_start();
> error_reporting(E_ALL);
> ?>
>
> So I need to add a specific cookie/ token ?

You just use the $_SESSION to store and fetch data as I mentioned in my
post from 7th of March.

The page you posted the values to:

$_SESSION['serialized_order'] = serialize($order);

and on the page where you need all the data:

$order = unserialize($_SESSION['serialized_order']);

if you need to modify the data, then read it from the session and then
store it back to the session.

Keep in mind the session data is never sent to the browser, so the user
can't adjust the data on their side.

--
//Aho

Re: Replace punctuation in an associative array

<k9th4vFauniU1@mid.individual.net>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=837&group=comp.lang.php#837

  copy link   Newsgroups: comp.lang.php
Path: i2pn2.org!i2pn.org!news.swapon.de!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail
From: user@example.net (J.O. Aho)
Newsgroups: comp.lang.php
Subject: Re: Replace punctuation in an associative array
Date: Fri, 14 Apr 2023 19:34:23 +0200
Lines: 197
Message-ID: <k9th4vFauniU1@mid.individual.net>
References: <ttq5np$i9r$50@gallifrey.nk.ca> <u18q9f$qtb$29@gallifrey.nk.ca>
<k9qanbFqbf1U1@mid.individual.net> <u1a06u$t8d$29@gallifrey.nk.ca>
<u1a99j$1gfe$15@gallifrey.nk.ca>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
X-Trace: individual.net WWWzLIjlozNXj9/z1C7FvAFDC9hT1TNXIYllBYykTpSW+8f5Df
Cancel-Lock: sha1:z54hsCZSzXwmJRL7KZqWGn93w0w=
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101
Thunderbird/102.9.1
Content-Language: en-US-large
In-Reply-To: <u1a99j$1gfe$15@gallifrey.nk.ca>
 by: J.O. Aho - Fri, 14 Apr 2023 17:34 UTC

On 4/14/23 03:12, The Doctor wrote:
> 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();

Try to avoid all these arrays, they don't make life easier.

> class Storevs{
> }
> class Item
> {
> }
> class TaxItem
> {
> }
>
> class CartItem
> {
> public $items;
> public $subtotal;
> public $tax;
> };
>
> class Contact
> {
> }
>
> class Shipping
> {
> }
>
> class Billing
> {
> }

Don't define the classes here, then you need to do it each file you use,
you create an php script that just includes the classes and then use include
https://www.php.net/manual/en/function.include.php

> $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
> }

prices shouldn't be hard coded, you don't want to change the code just
for the price went up due of inflation, you change the price in a
database of some sort.

> $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);

Hey, this ain't a value you can trust, you need to go trough all the
items in the cart, check up the price for each item and calculate the total.

Say a user with one of the many browser plugins that allows you to
modify post data, the user just adds all the items it wants and then
change the value for charge_total to 0, please calculate how pissed your
boss will be.

>
> $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 />";

why do you echo the html code? leave those outside the php code, you can
have multiple <?php ?> in a page.

> 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>";

Here you use a foreach loop that goes over the cart items, of course you
need to deserialize the $_SESSION['serialized_Obj'].
https://www.php.net/manual/en/control-structures.foreach.php

> ?>
> <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>

--
//Aho

Re: Replace punctuation in an associative array

<ka32kmF6nfjU1@mid.individual.net>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=842&group=comp.lang.php#842

  copy link   Newsgroups: comp.lang.php
Path: i2pn2.org!i2pn.org!news.swapon.de!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail
From: user@example.net (J.O. Aho)
Newsgroups: comp.lang.php
Subject: Re: Replace punctuation in an associative array
Date: Sun, 16 Apr 2023 22:03:34 +0200
Lines: 282
Message-ID: <ka32kmF6nfjU1@mid.individual.net>
References: <ttq5np$i9r$50@gallifrey.nk.ca> <u1a99j$1gfe$15@gallifrey.nk.ca>
<k9th4vFauniU1@mid.individual.net> <u1cjle$k24$48@gallifrey.nk.ca>
<u1gqb7$h84$56@gallifrey.nk.ca>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
X-Trace: individual.net R09t8rLDN3bACnwU+inVZwzxBihEPjdy5BvO+ZRw0zuEIMT7If
Cancel-Lock: sha1:VpwmXoKfsZIEFQHvs9rCXJbYq2c=
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101
Thunderbird/102.10.0
Content-Language: en-US-large
In-Reply-To: <u1gqb7$h84$56@gallifrey.nk.ca>
 by: J.O. Aho - Sun, 16 Apr 2023 20:03 UTC

On 4/16/23 14:40, The Doctor wrote:
> In article <u1cjle$k24$48@gallifrey.nk.ca>,
> The Doctor <doctor@doctor.nl2k.ab.ca> wrote:
>> In article <k9th4vFauniU1@mid.individual.net>,
>> J.O. Aho <user@example.net> wrote:
>>> On 4/14/23 03:12, The Doctor wrote:
>>>> 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();
>>>
>>> Try to avoid all these arrays, they don't make life easier.
>>>
>>>> class Storevs{
>>>> }
>>>> class Item
>>>> {
>>>> }
>>>> class TaxItem
>>>> {
>>>> }
>>>>
>>>> class CartItem
>>>> {
>>>> public $items;
>>>> public $subtotal;
>>>> public $tax;
>>>> };
>>>>
>>>> class Contact
>>>> {
>>>> }
>>>>
>>>> class Shipping
>>>> {
>>>> }
>>>>
>>>> class Billing
>>>> {
>>>> }
>>>
>>> Don't define the classes here, then you need to do it each file you use,
>>> you create an php script that just includes the classes and then use include
>>> https://www.php.net/manual/en/function.include.php
>>>
>>>> $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
>>>> }
>>>
>>> prices shouldn't be hard coded, you don't want to change the code just
>>> for the price went up due of inflation, you change the price in a
>>> database of some sort.
>>>
>>>> $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);
>>>
>>> Hey, this ain't a value you can trust, you need to go trough all the
>>> items in the cart, check up the price for each item and calculate the total.
>>>
>>> Say a user with one of the many browser plugins that allows you to
>>> modify post data, the user just adds all the items it wants and then
>>> change the value for charge_total to 0, please calculate how pissed your
>>> boss will be.
>>>
>>>>
>>>> $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 />";
>>>
>>> why do you echo the html code? leave those outside the php code, you can
>>> have multiple <?php ?> in a page.
>>>
>>>> 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>";
>>>
>>> Here you use a foreach loop that goes over the cart items, of course you
>>> need to deserialize the $_SESSION['serialized_Obj'].
>>> https://www.php.net/manual/en/control-structures.foreach.php
>>>
>>
>> Got you on all accounts!
>>
>>>
>>>> ?>
>>>> <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>
>>>
>>> --
>>> //Aho
>>
>>
>
>
> All right, trying to debug this here is what is happening:
>
> code snippet
>
> echo "<h3> Course Information </h3>";
> echo '<pre>'; print_r($cart); echo '</pre>';
> $keys = array_keys($cart);
> print_r($keys);
>
> foreach ($_POST['quantity'] as $key => $value) {
> if( $value > 0){


Click here to read the complete article
1
server_pubkey.txt

rocksolid light 0.9.8
clearnet tor