toonz Posted April 14, 2008 Share Posted April 14, 2008 Good morning. I have a quick question on how to create and display a default form field value in an html document I have. The current line looks like this <input class="Input" value="{opt1}" name="{opt1_Name}" style="WIDTH: 336px" size="50" > What is the tag I need to add in order to create a default value that will display in the field, but can be written over if I need to change it to something else? Your help is greatly appreciated. Thanks Link to comment https://forums.phpfreaks.com/topic/101074-php-form-field-default-value/ Share on other sites More sharing options...
trq Posted April 14, 2008 Share Posted April 14, 2008 None of that looks like php to me, maybe some template engine? Anyway, in php it would look something like.... <input class="Input" value="<?php echo isset($_POST['fld']) ? $_POST['fld'] : 'default value'; ?>" name="{opt1_Name}" style="WIDTH: 336px" size="50" > Link to comment https://forums.phpfreaks.com/topic/101074-php-form-field-default-value/#findComment-516827 Share on other sites More sharing options...
toonz Posted April 14, 2008 Author Share Posted April 14, 2008 well, it would most likely be html than, since its a form that is pulling information from a .php file. the 'value' tag is actually the name of the field in the sql database, so I dont want to mess with that or it probably wont pull any information from the database. This was part of a script that was made for me awhile ago, and now I need to make some small changes which is where Im getting stuck. Thanks for your reply Link to comment https://forums.phpfreaks.com/topic/101074-php-form-field-default-value/#findComment-516857 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.