t_lnumber php code example

Example: t_lnumber php

@extends('./layout') @section('content')    @if(Session::has('cart'))        <?php            $cart = Session::get('cart');            for ($i=0; $i < count($cart); $i++) {                echo "<li>".$cart[$i]->productName.":".$cart[$i]->amount."</li>                <form action='/deleteFromCart' method='post'>";?>                    @csrf                <?php echo("<input type='hidden' name='productName' value='".$cart[$i]->productName."'>                    <button type='submit'>X</button>                </form>                <form action='/editCart' method='post'>");?>                    @csrf                <?php echo("<input type='hidden' name='productName' value=".$cart[$i]->productName.">                    <input type='number' name='productAmount' min="1" value=".$cart[$i]->amount.">                    <button type='submit'>Edit amount</button>                </form>");            }        ?>    @endif    <table>        <tr>            <th>Name</th>            <th>Price</th>            <th>Category</th>            <th>Amount</th>        </tr>        <tr>            <td>{{$product->productName}}</td>

Tags:

Misc Example