0
I have a form and need to pass the value of the session via post method. I’m using the code below, but it’s not working.
<input type="hidden" name="cod_usuario" value="<?php session_start(); $_SESSION['login']; ?>" class="input-medium" id="txtFuncionario" title="Nome do Funcionário"/>
Obs: session_start(); has to be at the beginning of the file by default... put the code every pf friend
– MarceloBoni
Thank you. The code is too big. I put it on http://jsfiddle.net/2L7zLmoc/
– fabricio_wm
The text is on line 100.
– fabricio_wm
Doesn’t work like? Returns an error? It’s empty? What’s the point of sending the session id in a POST? Explain better, the way you’re alone you understand.
– Filipe Moraes
I need to pass the user who is logged in. It is getting blank.
– fabricio_wm
Why don’t you do it in "Formcados.php" (It’s in your form action)? Note: whenever you refer to a user in the comments, use the @ (arroba), a list will appear with the names of who commented, choose the recipient. Only then will the user receive an alert and realize that you have made reference to what he commented.
– Filipe Moraes
@Philip. It may be that way, but I tested it and it wasn’t working. I perform the test by passing 1 straight to variable and the system entered into the database normally. Then I put the below and did not insert anything into the bank.
'<?php
session_start();

 require '../php/funcao_mysql.php';
 
$cod_os = $_POST['N_OS']; //1 - Número da OS
$cod_usuario = $_SESSION['login'];
'– fabricio_wm