0

I am just learning php and I need to set the value of a session to the html textbox. I wrote the php code inside value attribute of the input but it displaying the entire code instead of the variable stored in the session. Please guide me.

<input type="text" name="usernametxt" value="<?php echo $_SESSION["user"]; ?> "/>
batwing
  • 257
  • 1
  • 8
  • 22
  • You seem to have wrong web server setup - php seems disabled... Can you post setup details: web-server, installed modules, OS, etc? - alternatively see [php_info](http://php.net/manual/en/function.phpinfo.php) – urban Sep 16 '17 at 10:44
  • Im using Xammp, win 8.1...I have other php function in other page which works fine. Only displaying variable in textbox is not working. It shows the php code i wrote in the textbox – batwing Sep 16 '17 at 10:47
  • 1
    @batwing : are you running above code in `.php` file ? – Niklesh Raut Sep 16 '17 at 11:00
  • 1
    Can confirm the filename is `.php` and not `.html`? – Lawrence Cherone Sep 16 '17 at 11:00
  • Sorry, yes the filename was html. I have changed it to php. Now working finely. Sorry again. – batwing Sep 16 '17 at 11:03

0 Answers0