Shopping Cart only enters last item in Database not all of the data

时间:2017-08-30 20:42:31

标签: php mysql mysqli

I am having an issue with my shopping cart when I add three items only the last item enters into the database. I am not sure how to get all the items to insert into the database like 3 or 4. I have tried many different ways and still come up with nothing. I still have to also figure how to get subtotal and customer name to attach to the orders

Index.php

class="fa"

process_insert.php

<li><i class="fa fa-iconname" aria-hidden="true"></i></li>

1 个答案:

答案 0 :(得分:1)

That's because your submit form doesnt support multiple fields. You have to add a index to each inputs' name.

    let componentFactory = this.factoryResolver.resolveComponentFactory(componentType),
        componentRef = componentFactory.create(this.injector, null, selectorOrNode);

    componentRef.changeDetectorRef.detectChanges();

process_insert.php

    let enumerateProperties = obj => Object.keys(obj).map(key => obj[key]),
        properties = enumerateProperties(injector.get(NgZone))
                         .filter(p => p instanceof EventEmitter);

    let subscriptions = Observable.merge(...properties)
                                  .subscribe(_ => changeDetectorRef.detectChanges());