Pi_Mastuh Posted December 3, 2006 Share Posted December 3, 2006 How do you make the forms that already have data in them? I'm making a change user info page and I'd like the form to have their current info already so it's easier to change. Link to comment https://forums.phpfreaks.com/topic/29315-variable-and-text-fields/ Share on other sites More sharing options...
chiprivers Posted December 3, 2006 Share Posted December 3, 2006 you can specify default text in a form field by using value="blah"ie.[code]<input type="text" name="username" value="JoeBloggs">[/code] Link to comment https://forums.phpfreaks.com/topic/29315-variable-and-text-fields/#findComment-134362 Share on other sites More sharing options...
Pi_Mastuh Posted December 3, 2006 Author Share Posted December 3, 2006 But if it's in an html page it will just end up saying Name: $name Link to comment https://forums.phpfreaks.com/topic/29315-variable-and-text-fields/#findComment-134376 Share on other sites More sharing options...
papaface Posted December 3, 2006 Share Posted December 3, 2006 You would put the form in php:[code]<?phpecho "<form action=\"". $_SERVER["PHP_SELF"] ."\" method=\"post\" enctype=\"multipart/form-data\"> <input type=\"text\" name=\"username\" value=\"".$variable."\"> <input name=\"submit\" type=\"submit\" /> </form>";?>[/code]Where $variable, would be the place you would want your user data to show. Link to comment https://forums.phpfreaks.com/topic/29315-variable-and-text-fields/#findComment-134378 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.