# php form field default value



## toonarific (Aug 17, 2004)

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

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


----------



## Mudley (Apr 7, 2008)

is that supposed to be a text input?
the default value is the value attribute, so value="Default value"

however you don't have an input type, if its text, you need type="text"


----------



## toonarific (Aug 17, 2004)

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


----------



## Mudley (Apr 7, 2008)

can you post more code please.

i'm fluent in html and php and would be happy to help


----------



## toonarific (Aug 17, 2004)

here is the full code for that piece of the form

[TR]
[TD]Opt
1 (Price)[/TD] 
[TD][/TD] 
[/TR]


----------



## Mudley (Apr 7, 2008)

is this within a smarty templating system?

can you view source of the website and find that form input and copy it as well?


----------



## toonarific (Aug 17, 2004)

This is the code for the form field

[TR]
[TD]Opt
1 (Price)[/TD] 
[TD][/TD] 
[/TR]


----------



## Mudley (Apr 7, 2008)

so the value of the input is {opt1}, the user can edit that to whatever they want.

is that what you want?
you may need to rephrase your original request


----------



## toonarific (Aug 17, 2004)

it appears my old programmer made the value tag the linked name to the field within the database. when I view the field itself when Im logged in, nothing appears as a default text in the field. Opt 1 is not visible, so as 'value' it is not the default text. All the fields in my form appear to have the value tag being the link to the database


----------

