i have input field holds quantity of item. if user changes quantity value update value stored in session. problem cannot "value".
<form method="post"> <input type="number" class="form-control text-center" name="quantityinput" size="1" maxlength="2" value="'.$cart_itemdisplay['quantity'].'"> <button class="btn btn-info btn-sm" method="post" name="refreshbtn"><i class="fa fa-refresh"></i></button> </form>
when try store value:
$quantityofitemtoadjust = $_post['quantityinput'];
full code:
echo ' <tbody> <tr> <td data-th="product"> <div class="row"> <div class="col-sm-2 hidden-xs"><img src="img/movies/'.$imagename.'" alt="..." class="img-responsive"/></div> <div class="col-sm-10"> <h4 class="nomargin">'.$nameofproduct.'</h4> <p>'.$productdesc.'</p> </div> </div> </td> <td data-th="price">£'.$priceofitem.'</td> <td data-th="quantity"> <form method="post" action="tickets.php"> <input type="number" class="form-control text-center" name="quantityinput" size="1" maxlength="2" value="'.$cart_itemdisplay['quantity'].'"> </form> </td> <td data-th="subtotal" class="text-center">1.99</td> <td class="actions" data-th=""> <form method="post" action="tickets.php"> <button class="btn btn-info btn-sm" method="submit" name="refreshbtn"><i class="fa fa-refresh"></i></button> <input name="item_to_adjust" type="hidden" value="'.$idofitem.'"/> <button class="btn btn-danger btn-sm"><i class="fa fa-trash-o"></i></button> </form> </td> </tr> </tbody> ';
you should use submit instead of button , form need action.
<form method="post" action="yourpage.php"> <input type="number" class="form-control text-center" name="quantityinput" size="1" maxlength="2" value="'.$cart_itemdisplay['quantity'].'"> <input type="submit" class="btn btn-info btn-sm" name="refreshbtn" value="refresh"> </form>
this shall work.
Comments
Post a Comment