从标签php获取变量

时间:2022-11-27 21:52:27

hello well my problem is that am displaying a list of messages like mails and when you want to read full message u need to go to rmq-demande.php where the full message appeard : here how my list of messages is presented i need to get the id of each message when clicked on it :

你好我的问题是我显示的邮件列表,如邮件,当你想阅读完整的消息,你需要去rmq-demande.php,其中完整的消息显示:这里我的消息列表如何呈现我需要得到点击它时每条消息的ID:

     <?php 
          $sql_rev=mysql_query("SELECT * from demande_revision WHERE lu='nl' ");
                $comment_count=mysql_num_rows($sql_rev);
                ?>
                    <li class="xn-icon-button pull-right">
                        <a href="#"><span class="fa fa-comments"></span></a>
                        <div class="informer informer-danger">   <?php if($comment_count!=0)
                {
                echo "$comment_count nouveau";
                }?>
                  </div>
<div class="panel panel-primary animated zoomIn xn-drop-left xn-panel-dragging">
                            <div class="panel-heading">
   <h3 class="panel-title">
<span class="fa fa-comments"></span> </h3>                                
                    <div class="pull-right">
                 <span class="label label-danger"><?php if($comment_count!=0)
                {
                echo "$comment_count nouveau";
                }?> </span>
                           </div>
                            </div>
 <div class="panel-body list-group list-group-contacts scroll" style="height: 200px;">
                            <?php
                               while ( $msg=mysql_fetch_assoc($sql_rev)) {
                               $idd=$_SESSION['id_dem']=$msg['id_dem'];
                               $title=$msg['title'];
                               $dem=$msg['msg'];

                           echo "
           <form name=\"theform\" method=\"post\" action=\"rmq-demande.php\">
               <input type=\"hidden\" name=\"id_demm\" value=\"$idd\"> 

         <a href=\"rmq-demande.php\" class=\"list-group-item\" target='_blank'>
                                    <span class=\"contacts-title\">$title</span>
                                    <p>$dem</p>
                                </a> </form>";

                        }
                            ?>   
                            </div>

in the other page (rmq-demande.php) here is how i wanted to get the variable $idd:

在另一页(rmq-demande.php)这里是我想要获得变量$ idd:

$dem=$_POST['id_demm'];

but it gets nothing plz help

但它没有任何帮助

1 个解决方案

#1


0  

You can do it in 2(two) way:-

你可以用2(2)种方式做到: -

1. remove link and create submit button like below:-

echo "
<form name=\"theform\" method=\"post\" action=\"rmq-demande.php\">
<input type=\"hidden\" name=\"id_demm\" value=\"$idd\"> 

<span class=\"contacts-title\">$title</span>
<p>$dem</p>
<input type = \"submit\" name= \"submit\" value=\"submit\" >
</a> </form>";
  1. Or remove form and append id into link like below:-

    或者删除表单并将id附加到链接中,如下所示: -

    echo "<a href=\"rmq-demande.php?id_demm=$idd\" class=\"list-group-item\" target='_blank'>
                                        <span class=\"contacts-title\">$title</span>
                                        <p>$dem</p>";
    

But for getting id through this in php you need to do like this:-

但是为了在php中获取id,你需要这样做: -

    $dem=$_GET['id_demm'];

Note:- first way is more secure. thanks

注意: - 第一种方式更安全。谢谢

#1


0  

You can do it in 2(two) way:-

你可以用2(2)种方式做到: -

1. remove link and create submit button like below:-

echo "
<form name=\"theform\" method=\"post\" action=\"rmq-demande.php\">
<input type=\"hidden\" name=\"id_demm\" value=\"$idd\"> 

<span class=\"contacts-title\">$title</span>
<p>$dem</p>
<input type = \"submit\" name= \"submit\" value=\"submit\" >
</a> </form>";
  1. Or remove form and append id into link like below:-

    或者删除表单并将id附加到链接中,如下所示: -

    echo "<a href=\"rmq-demande.php?id_demm=$idd\" class=\"list-group-item\" target='_blank'>
                                        <span class=\"contacts-title\">$title</span>
                                        <p>$dem</p>";
    

But for getting id through this in php you need to do like this:-

但是为了在php中获取id,你需要这样做: -

    $dem=$_GET['id_demm'];

Note:- first way is more secure. thanks

注意: - 第一种方式更安全。谢谢