View a text input in PHP echo

December 2016




Issue


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?

Solution


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 (ccm.net) 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.