View a text input in PHP echo

October 2016


I want to display a input type = "text" in a PHP echo.
  • echo "<input type=\"text\" readonly=\"readonly\" value=\"<?php echo $_SESSION[\'name\'];?> >"; 
  • Could you help me please?


Use this code:
  • echo "<input type=\"text\" readonly=\"readonly\" value=\"".$_SESSION['name']."\">"; 

Related :

This document entitled « View a text input in PHP echo » from CCM ( is made available under the Creative Commons license. You can copy, modify copies of this page, under the conditions stipulated by the license, as this note appears clearly.