Skip to content Skip to sidebar Skip to footer

Echo PHP Variable As An Value Of Input Field

I have a simple HTML form with multiple input tags. On page load i provide data to the form to echo the current value of field from database and than user can modify those values a

Solution 1:

HTML attribute values should generally be wrapped in quotes:

<input type="text" name="nameMember" id="nameMember" value="<?php echo (isset($nameMember)) ? $nameMember: ''?>">

exactly as you already do with the type and name attributes

The value attribute is no different


Solution 2:


Solution 3:

You forget to add quotes in value attribute like value="" in quotes echo your variable ,in HTML quotes generate automatically and if space found attribute automatically close quotes after space

 value="<?php echo (isset($nameMember)) ? $nameMember: ''?>"

Post a Comment for "Echo PHP Variable As An Value Of Input Field"