dougu2036 2018-08-18 21:00
浏览 9
已采纳

从显示的表中发送特定数据(PHP)

I have complicated problem enter image description here

In this image I created php page to get the data from mysql database and every message have id in database If I click on image of check mark we will go to another page to answer the message

I get the id already from the DB

"SELECT msgId.....

and store it in var from the next array

while($row = mysqli_fetch_array($result)){
            ..............
            $msgIdVar = $row['msgId'];

and the check mark image is input form

<input type="image" src="img/chckMrk.jpg" alt="Submit Form" name="msgIdVar" value=""/>

when I try to pass the $row['msgId'] as a $_POST var, it didn't working with me!

<input type="image" src="img/chckMrk.jpg" alt="Submit Form" name="msgIdVar" value="' . <?php echo $msgIdVar; ?> . '"/>

also this doesn't work:

.....value="' . <?php echo $row['msgId']; ?> . '"/>

The problem here:

I want if we click the second message for example, send the id for this message to another page

How can i do it???

  • 写回答

1条回答 默认 最新

  • dtutlamjasblef7982 2018-08-18 21:45
    关注

    You can't use an <input type="image"> to send data using a form. Use an <input type="hidden">, and use your image as the trigger to submit the form:

    <form method="post" action="">
        <input type="hidden" name="msgIdVar" value="<?php echo $msgIdVar ?>" />
        <input type="image" src="img/chckMrk.jpg" alt="Submit Form" onclick="this.form.submit()" />
    </form>
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥100 set_link_state
  • ¥15 虚幻5 UE美术毛发渲染
  • ¥15 CVRP 图论 物流运输优化
  • ¥15 Tableau online 嵌入ppt失败
  • ¥100 支付宝网页转账系统不识别账号
  • ¥15 基于单片机的靶位控制系统
  • ¥15 真我手机蓝牙传输进度消息被关闭了,怎么打开?(关键词-消息通知)
  • ¥15 装 pytorch 的时候出了好多问题,遇到这种情况怎么处理?
  • ¥20 IOS游览器某宝手机网页版自动立即购买JavaScript脚本
  • ¥15 手机接入宽带网线,如何释放宽带全部速度