<textarea> does not have value.
You need to echo that variable inside the tags.
$html = "Text here"; echo '<textarea readonly style="border:none;resize:none" rows="50" cols="116">'. $html .'</textarea>';
"it must take the variables from $_SESSION and complete the code"
Also note that you are using sessions. Make sure the session was started having session_start(); at the top of that page and for any other pages that may be using sessions.
Example:
session_start(); if(isset($_SESSION['var'])){ $_SESSION['var'] = "var"; } else{ echo "Session is not set."; }
N.B.: Make sure you are not outputting before header.
Consult the following on Stack if you get a headers sent notice/warning:
Add error reporting to the top of your file(s) which will help find errors.
<?php error_reporting(E_ALL); ini_set('display_errors', 1); // Then the rest of your code
Sidenote: Displaying errors should only be done in staging, and never production.
Test example which proved successful, echoing var inside <textarea>:
<?php session_start(); if(isset($_SESSION['var'])){ $_SESSION['var'] = "var"; $var = $_SESSION['var']; } else{ echo "Session is not set."; } // $html = "Text here"; $html = $var; echo '<textarea readonly style="border:none;resize:none" rows="50" cols="116">'. $html .'</textarea>';
Edit:
Base yourself on the following model to assign GET arrays to sessions arrays.
<?php session_start(); $_GET ['lb1'] = "lb1"; $lb1 = $_GET ['lb1']; $_GET ['lb1'] = $_SESSION["lb1"]; $_SESSION["lb1"] = $lb1; //echo "Hey LB1 " . $lb1; $lb1_session = $lb1; $_GET ['lb2'] = "lb2"; $lb2 = $_GET ['lb2']; $_GET ['lb2'] = $_SESSION["lb2"]; $_SESSION["lb2"] = $lb2; //echo "Hey LB2" . $lb2; $lb2_session = $lb2; $html = $lb1_session . "\n". $lb2_session; echo '<textarea readonly style="border:none;resize:none" rows="50" cols="116">'. $html .'</textarea>'; ?> <a href="check_get_sessions.php">Check GET sessions</a>
check_get_sessions.php
<?php session_start(); if(isset($_SESSION['lb1'])){ $lb1_session = $_SESSION['lb1']; echo $lb1_session; } if(isset($_SESSION['lb2'])){ $lb2_session = $_SESSION['lb2']; echo $lb2_session; } $html = $lb1_session . "\n". $lb2_session; echo '<textarea readonly style="border:none;resize:none" rows="50" cols="116">'. $html .'</textarea>';
That's the best I can offer you.
Doing $html = $lb1_session . "\n". $lb2_session; you can use "\n" as seperators between each variable to be echo'd. Or, <br> if you want; the choice is yours.
The above assigns the $html variable to chained variables. You can add the others that may need to be added $lb3, $lb4, $lb5 etc.
Good luck! (buon fortunato)
<textarea>does not havevalue.echo '<textarea readonly style="border:none;resize:none" rows="50" cols="116">'.$html.'</textarea>';