1. Computer problem? Tech Support Guy is completely free -- paid for by advertisers and donations. Click here to join today! If you're new to Tech Support Guy, we highly recommend that you visit our Guide for New Members.

php form field default value

Discussion in 'Web Design & Development' started by toonarific, Apr 14, 2008.

Thread Status:
Not open for further replies.
Advertisement
  1. toonarific

    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
     
  2. Mudley

    Mudley

    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"
     
  3. toonarific

    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
     
  4. Mudley

    Mudley

    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 :)
     
  5. toonarific

    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>
     
  6. Mudley

    Mudley

    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?
     
  7. toonarific

    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>
     
  8. Mudley

    Mudley

    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
     
  9. toonarific

    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
     
  10. Sponsor

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 733,556 other people just like you!

Loading...
Similar Threads - form field default
  1. howard.a.s
    Replies:
    5
    Views:
    499
  2. bobzani
    Replies:
    0
    Views:
    761
  3. brentfuller0
    Replies:
    3
    Views:
    362
Thread Status:
Not open for further replies.

Short URL to this thread: https://techguy.org/703650

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice