html - How to get a request parameters like a associative array -


let have list of text fields. every text field responsible product id, , want know how items should buy.

the result parameters should { :1 => 2, :5 => 8 }, means user buy 2 items of product id 1, , 8 items of product id 5.

what's expected name attributes of expected input[type="text"] html tags case?

let's have

<input type="text" name="product<?php echo $product_id; >"></input> 

you can submit value using jquery

var x = $('input[name=\'product' + pid + '\']').val(); // pid product_id  

on server can use

$this->request->get['product'.$pid];//pid product_id 

Comments

Popular posts from this blog

android - Gradle sync Error:Configuration with name 'default' not found -

java - Andrioid studio start fail: Fatal error initializing 'null' -

html - jQuery UI Sortable - Remove placeholder after item is dropped -