html - get variable from <a> tag php -


hello problem displaying list of messages mails , when want read full message u need go rmq-demande.php full message appeard : here how list of messages presented need id of each message when clicked on :

     <?php            $sql_rev=mysql_query("select * demande_revision 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 other page (rmq-demande.php) here how wanted variable $idd:

$dem=$_post['id_demm']; 

but gets nothing plz help

you can in 2(two) way:-

1. remove link , create submit button 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 , append id link below:-

    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 getting id through in php need this:-

    $dem=$_get['id_demm']; 

note:- first way more secure. thanks


Comments

Popular posts from this blog

javascript - gulp-nodemon - nodejs restart after file change - Error: listen EADDRINUSE events.js:85 -

Fatal Python error: Py_Initialize: unable to load the file system codec. ImportError: No module named 'encodings' -

javascript - oscilloscope of speaker input stops rendering after a few seconds -