php form field default value

Status
This thread has been Locked and is not open to further replies. Please start a New Thread if you're having a similar issue. View our Welcome Guide to learn how to use this site.

toonarific

Thread Starter
Joined
Aug 17, 2004
Messages
18
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
 
Joined
Apr 6, 2008
Messages
101
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

Thread Starter
Joined
Aug 17, 2004
Messages
18
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
 
Joined
Apr 6, 2008
Messages
101
can you post more code please.

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

toonarific

Thread Starter
Joined
Aug 17, 2004
Messages
18
here is the full code for that piece of the form

<tr>
<td class="FieldCaptionTD">Opt
1 (Price)</td>
<td class="DataTD"><input class="Input" value="{opt1}" name="{opt1_Name}" style="WIDTH: 336px" size="50" ></td>
</tr>
 
Joined
Apr 6, 2008
Messages
101
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

Thread Starter
Joined
Aug 17, 2004
Messages
18
This is the code for the form field

<tr>
<td class="FieldCaptionTD">Opt
1 (Price)</td>
<td class="DataTD"><input class="Input" value="{opt1}" name="{opt1_Name}" style="WIDTH: 336px" size="50" ></td>
</tr>
 
Joined
Apr 6, 2008
Messages
101
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

Thread Starter
Joined
Aug 17, 2004
Messages
18
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
 
Status
This thread has been Locked and is not open to further replies. Please start a New Thread if you're having a similar issue. View our Welcome Guide to learn how to use this site.

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

As Seen On
As Seen On...

Welcome to Tech Support Guy!

Are you looking for the solution to your computer problem? Join our site today to ask your question. This site is completely free -- paid for by advertisers and donations.

If you're not already familiar with forums, watch our Welcome Guide to get started.

Join over 807,865 other people just like you!

Latest posts

Staff online

Top