Hello everyone,

I used in my htlm/php page the code of site where the data is showed in this part.:

<div class="row" id="records"><div class="col-sm-4" id="emp_id"></div>

The value what that script gets from my database is put in id="emp_id".
Now my question is as next.
Is it possible to put id="emp_id" into a php variable?
So i also can read that into the rest of my vars ike here?

  foreach ($_POST as $key => $val)
    $_SESSION[$key] = $val;

You want the $_POST superglobal to have an item indexed 'emp_id' with the data in the div as the value after a form has been sent? Are you using vanilla PHP to send the form or Ajax. If using ajax, you can send any data via POST, but HTML form submission, will only allow data from INPUT, SELECT, TEXTAREA etc. and not DIV. If you need this via HTML form submission, you can create a hidden input with that data - although this is duplication.

No not before send, when choosing a product in the dropdown, the values are showed directly in, for example , id="emp_id".
But i want to have that value also send to another page but then as a $var so i can send it by this part.:

if (isset($_POST['submit'])){
    foreach ($_POST as $key => $val)
    $_SESSION[$key] = $val;

When you get emp_id from the database just put it into your session variable like so:

$_SESSION["id"] = $emp_id

Where $emp_id represents the value from the database. Once it is in the session array, there is no need to return to the database or a form in order to read its value for as long as the session is valid.

Sorry pascalbianca, I have no idea what that means. Hopefully rbolly has what you need.

@rbjolly, thats not working.
The script that i inplanted in my side is this one.: Click Here
But once readed, the values are gone, but i also want to use some values i another page therefore i want some values global if you know what i mean.