Jump to content

php form field default value


toonz

Recommended Posts

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
Share on other sites

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
Share on other sites

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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.