Quantcast
Channel: Ionic Forum - Latest topics
Viewing all articles
Browse latest Browse all 70432

How to insert checkbox values using php to mysql

$
0
0

@lily28 wrote:

I created an expandable list with checkbox, and wish to save the value of the checked box in mysql using php. I am totally new with php and mysql so I’m clueless what to do next.

This is the expandable list
image
I stored the parent and children list in information.json

{
    "items": [
        {
            "name": "Color",
            "children": [
                { "name": "Black" },
                { "name": "White" },
                { "name": "Yellow" }
            ]
        },
       {
            "name": "Size",
            "children": [
                { "name": "Large" },
                { "name": "Small" }
            ]
        },
        {
            "name": "Shape",
            "children": [
                { "name": "Circle" },
                { "name": "Square" }
            ]
        },
        {
            "name": "Coupons",
            "children": []
        }
    ]
}

The parent list (Color, Size, Shape, Coupons) was included in home.page.html

<ion-header>
  <ion-toolbar color="primary">
    <ion-title>
      List
    </ion-title>
  </ion-toolbar>
</ion-header>

<ion-content>

<ion-list *ngFor="let item of information; let i = index;" class="accordion-list" lines="full">
  <ion-item tappable (click)="toggleSection(i)" [ngClass]="{'section-active': item.open, 'section-inactive': !item.open}">
    <ion-icon slot="end" name="arrow-forward" *ngIf="!item.open"></ion-icon>
    <ion-icon slot="end" name="arrow-down" *ngIf="item.open"></ion-icon>
    <ion-label class="label">
      {{item.name}}
    </ion-label>
  </ion-item>

  <div *ngIf="item.children && item.open">

    <app-product *ngFor="let child of item.children" [product]="child"></app-product>

  </div>

  <p *ngIf="item.children.length == 0 && item.open" text-center>Sorry, nothing in here!</p>
</ion-list>

</ion-content>

the tag selector is to perform the expandable list from the new created component, product.component.html

<ion-item lines="none">
  <ion-label>{{product.name}}</ion-label>
  <ion-checkbox slot="end" (click)="buyItem(product)"></ion-checkbox>
</ion-item>

Can anyone guide me what to do next to enable the checked values store in mysql ?

Posts: 1

Participants: 1

Read full topic


Viewing all articles
Browse latest Browse all 70432

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>