I have a problem that I have got data in variable like this $name="Test User"; but when I keep this variable in echo its printing well but when I keep it in the textbox echo "<input type=text name=txtname value=".$name.">"; PHP: then its only showing "Test" in the textfield it means it is displaying only one word can anyone help me?
Use this instead: echo "<input type=text name=txtname value=\"".$name."\">"; Code (markup): You need to put quotes ("") around the value paramter also!
Your syntax is wrong. --------- Either echo '<input type="text" name="txtname" value="'.$name.'" />'; PHP: or echo "<input type=\"text\" name=\"txtname\" value=\"$name\" />"; PHP: The first one is better.
You can do this also <input type="text" name="txtname" value="<?php echo $name; ?>" /> Code (markup):