开发者

PHP problem in functions with params

I ma not quit experienced on PHP programming, and I am making an application PHO + HTML.

I am in the point that I am getting a list of results from the database and I want to provide the user a method to edit or delete each of them.

My code is:

while($row= mysql_fetch_array($res)){
            $_SESSION['nombre'] = $row["nombre"]; 
            $nombre = $row["nombre"];
            $descripcion = $row["descripcion"];
            $imgPath = $row["imagen"];
            $id = $row["id"];
            echo $id;
            ?>
            <!-- Each element on the table -->
            <table width="400" border="0" align="right">
                  <tr>
                    <td><p><?php echo $nombre; ?>
                </p>
                    <p class="TextoNormal"> <?php echo $descripcion; ?></p></td>
                        <!-- html code -->
                    <td align="center"><input name="g开发者_如何学运维uest" type="button" value="<?php echo $nombre; ?>" onclick="window.open('servoclientapplet.html?serverIP=ip','newwin')" /></td>
                    <td align="center"><input name="guest" type="button" value="Editar" onclick="<?php EditApp($id); ?>" /></td>
                    <td align="center"><input name="guest" type="button" value="Eliminar" onclick="<?php echo($id); elminar($id); ?>" /></td>
                  </tr>

            <?php
        }

But neither EditApp($id) nor elminar($id) are receiver their parameters. How could I send it to them? In addition, to EditApp I would like to open a modal panel or a new page, to allow the user to write the updates, and then execute the query.

I add also each function code:

EditApp

function EditApp($id) { 
...
}

Delete

function elminar($id){
...
}

Thanks in advance!


Onclick is for javascript, not php. Instead, just create a form and have buttons for edit and delete. Pass id with POST.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜