html form position,how to access array form position dynamically in html/php form?

I am doing a little learning on php and and html using smarty to aid it.

I am trying to build a very simple shop-alike list with a cart image that when it is clicked, it is supposed to return via form the info I want from that item, but I am failing to get the index of the items right....

This is the code relative to the loop inside the tlp (it is a HTML internally used by smarty):

{section name=i loop=$homeList}

%7B%24homeList%5Bi%5D.img%7D{$homeList[i].Nome} {$homeList[i].Descricao}{$homeList[i].Preco} €{$homeList[i].Disponiblidade}

{/section}

and this is the code relative to the "experimental" php update:

require_once("functions.php");

var_dump($_POST);

and this is a sample var_dump output:

array

'usr' =>

array

0 => string 'abobora' (length=7)

1 => string 'abobora' (length=7)

2 => string 'abobora' (length=7)

3 => string 'abobora' (length=7)

4 => string 'abobora' (length=7)

'iditem' =>

array

0 => string 'it10' (length=4)

1 => string 'it13' (length=4)

2 => string 'it2' (length=3)

3 => string 'it20' (length=4)

4 => string 'it21' (length=4)

'qta' => string '1' (length=1)

'index' => string '1' (length=1)

'submit_x' => string '22' (length=2)

'submit_y' => string '27' (length=2)

The thing is: how do I tell the form that a single button has a singular index to the array and gain access to the correct info inside the array?

PS: the index="1" here is just an experimental value, what I wanted there is the info relative to the index

PSS: sorry for the bad output format, but there are times that I simply don't get how code tag works....

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值