简体   繁体   English

编辑项目zend Framework 2

[英]Edit an item zend framework 2

I want to edit something when i click on the edit button. 单击编辑按钮时,我想编辑一些内容。

so I made a foreach in my edit.phtml view to display some data. 所以我在edit.phtml视图中做了一个foreach以显示一些数据。 i also put them in a table. 我也把它们放在桌子上。

This is the edit.phtml : 这是edit.phtml:

<table class="table table-hover">

    <?php

    foreach($foods as $row) : ?>
        <tr>

            <td class="food_id"><?php echo $row->kindOfFood_id; ?></td>
            <td class="foodName"><?php echo $row->kindOfFood_name; ?></td>
            <td><a href="" class="vote">Vote</a></td>

        </tr>
    <?php endforeach;?>
</table>

but how can i vote on the right item by clicking the link? 但是如何单击链接对正确的项目进行投票? I know I first have to found the id of the right item but can somebody tell me how to do that ? 我知道我首先必须找到正确商品的ID,但是有人可以告诉我该怎么做吗? This is how my view looks like, so when I click on the first vote i want to update the chinese. 这就是我的看法,因此,当我单击第一票时,我想更新中文。 I also displayed the id's with it. 我还显示了ID。

在此处输入图片说明

Somebody help me ? 来人帮帮我 ?

Hmmm, There are different ways to build the url... 嗯,有多种方法可以构建网址...

how about something like this...: 这样的事情怎么样...:

<a href="/vote/id/<?php echo $row->kindOfFood_id; ?>" class="vote">Vote</a>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM