get variable from tag php

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 :

<?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:


but it gets nothing plz help

-------------Problems Reply------------

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

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>
<input type = \"submit\" name= \"submit\" value=\"submit\" >
</a> </form>";

  1. Or remove form and append id into link like below:-

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

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


Note:- first way is more secure. thanks

Category:php Views:5 Time:2018-12-04
Tags: php html

Related post

  • PHP - Get variables from another PHP file without executing the code? 2009-08-19

    I'm trying to create a script to extract the variables from a file on the same server. The problem is, I don't know what else is going to be in the file all of the time (the script is for other people to use), so I don't really want to load all of th

  • PHP get variables from JavaScript onClick (HTML)? 2011-08-20

    I need to get variables from a html link, this is the link and when it is clicked it shows the popup window. <a href='#' onclick=\"show('poruka');var idporuke=$porid; \">Pogledaj<a> And I have var idporuke=$porid; which is working like a

  • import all data variables from a php file without rendeiring it 2010-01-13

    i want to import all the data variables from a php file. but if i write: include 'user.php'; it loads that php file instead of the current file. any solutions? --------------Solutions------------- ob_start(); include 'user.php'; ob_end_clean(); // us

  • Using a get variable from URL to do a MYSQL Query 2011-01-20

    I am using a post variable and i am attempting to use a get variable from the url to login a user. Here is the process: Users get their own url, i.e and when they create their own account they have their username and pass When they

  • list / get variables from flash ( .swf) 2011-02-01

    is possible to get variable from flash to javascript, php... for example in flash i have : var myVar = 25; how i can get variable ( myVar ) from flash to javascript ( jquery, ajax or php.. ) smoething like myJsVar = myVar; ( from flash ) or how to li

  • Accessing cakephp session variable from a php script? 2011-08-08

    How can you access the cakephp session variable from a php script? I tried $_SESSION but it returns empty. I specifically want to get to the Auth session information. Thanks --------------Solutions------------- try this... session_name('CAKEPHP'); se

  • CakePHP question: Getting value from app_controller.php to layout.ctp 2011-09-08

    I have set values in app_controller.php and i can use those variable in 'default.ctp'. My question is: is it a good idea to get value from app_controller.php beforeRender() action ? Is there any other alternative to get value in default.ctp ? What's

  • MySQL error when getting variable from URL 2012-01-08

    This is the code I have, but I get this error when I try to get variable from the url: Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource The URL variable DEVID is a long string of characters, numbers, dashes, and un

  • Zend_Config_Xml get value from tag with atributes 2012-02-06

    I have XML like this: <?xml version="1.0"?> <configdata> <data> <data_name lang="en">Some name4</data_name> </data> </configdata> For parsing I use Zend_Config_Xml: $config = new Zend_Config_Xml($dir.$file,'d

  • Get variable from other file's class function 2012-02-20

    So, i want to get variable from other file's class function. Something like this : file lang.php: <?php class lang { function get() { $dubs = "dubs"; } } ?> file print.php: <?php require("lang.php"); lang::get(); echo $dubs; ?> But this r

  • GET request from a PHP script in a limited environment 2010-07-26

    I have to run a get request from a PHP script, but I'm in a fairly limited environment (tight firewalls, can't modify the PHP install, etc...). fsockopen() returns an error and http_get() seems to not be installed. The only other way I know of is to

  • Having trouble getting GET variables from url 2011-01-08

    I'm having trouble with this algorithm to extract the get variables from a url and print them each on a new line like: x=y z=hello etc. but instead it prints a seemingly random section of the url with no newlines to the file. There must be a logic er

  • Getting variables from one view to another 2011-04-19

    I realise that there are other topics like this, but none of them really help. I'm trying to get variables from one view into another, but I have absolutely no idea how. To give some backstory, my game is a fruit ninja like game where stuff goes on t

  • To get data from a php file to an android application 2011-09-15

    I am a newbie in using android applications. I would like to get data from a php file to android and I do not know how to do it. I will use a simple example of a php code which I want to get into android: $array = array(0 => 'zero', 1 => 'one',

  • Send variables from Symfony2 PHP file to js file 2013-06-14

    I'm really new to JavaScript and I could't fine some tutorials about this. If there are ones, please tell me to read them. What I want to do is pass variables from my PHP controller to a .js file - I want to populate Highcharts variables. I know that

  • How can Flash get a variable from a PHP file? 2012-01-09

    I'm trying to do a PHP-Flash communication in ActionScript 3. I can send from Flash to PHP but I don't know how Flash can get a variable from PHP file. Any help? --------------Solutions------------- Assuming your PHP code is on a server that has PHP

  • Calling a PHP page with get variables from Linux command line 2012-02-20

    I want to use wkhtmltopdf to convert a web page to a pdf. I have test with a static template and this syntax works perfectly wkhtmltopdf my.html my.pdf The problem is the actual page is a dynamic PHP page with tables that rely on 3 get variables. An

  • using global inside of function to get variable from included file. PHP 2010-07-07

    Really simple I just think it's me. this is file 1.php if(ctype_digit($_GET['id'])) { $item_id = "Hello"; } else { //Something } this is file 2.php function item_show(){ $item_query = "SELECT title FROM tbl_items WHERE id='" . mysql_real_escape_strin

  • multiple php sessions - get variable from other session 2011-04-19

    Possible Duplicate: Multiple PHP Sessions hi, i have a website that is managed by two CMSs (same host,same domain). Is there a way to retrieve the $_SESSION variable from CMS1 in CMS2? in short, i am trying to synchronise logins, but already failed i

  • How to remove a variable from a PHP session array 2010-02-09

    I have PHP code that is used to add variables to a session: <?php session_start(); if(isset($_GET['name'])) { $name = isset($_SESSION['name']) ? $_SESSION['name'] : array(); $name[] = $_GET['name']; $_SESSION['name'] = $name; } if (isset($_POST['r

  • Make a PHP GET request from a PHP script and exit 2010-05-06

    Is there something simpler than the following. I am trying to make a GET request to a PHP script and then exit the current script. I think this is a job for CURL but is there something simpler as I don't want to really worry about enabling the CURL p

  • PHP Beginner: How to pass PHP variable from one PHP code segment to another? 2010-06-06

    I have index.php which uploads a file to server and sets several PHP variables (like $target_folder_and_file_name). index.php also has the following line (it was originally index.html): <script language="JavaScript" src="main.js.php"></scrip

  • Get the GET variables from a URL String 2010-06-28

    Hey, say I have a url just being passed through my php is there any easy way to get some GET variables that are being passed through it? It's not the actual url of the page or anything. like a just have a string containing

  • Codeigniter, get variable from segment-based URL with querystrings 2010-12-28

    i've removed the index.php from my url but now i need to get some variable from the url , the CI solution is update the config.php $config['uri_protocol'] = "PATH_INFO"; $config['enable_query_strings'] = TRUE; this work perfectly when i use the index

  • Getting variable from jQuery GET request 2011-05-12

    I need to get a variable from inside the GET request and use it inside the function. It's not working. Here is my code: function chooseChosenOne() { $.get("generate.php", function(data) { var chosenOne = targetLocation[data.randomNumber]; }, "json");

Copyright (C), All Rights Reserved.

processed in 0.151 (s). 11 q(s)