FORUMS


The Form Tools forums are no longer active, but the old posts have been archived here. Please see the Help page on how to get help / report issues.

Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Default Value for Fields
#1
Hi, can anyone tell me how I set a field to have a default value?

Usually I would do this by writing value="myvalue" but I am already using this 'value' to make the form sticky eg as follows:

Code:
<input type="text" name="myfield" size="10" maxlength="15" value="<?=@$fields['myfield']?>"/>

Thanks in advance!
Reply
#2
Hi Spenny,

Try this:

Quote:<?php $val = (isset($fields['myfield'])) ? $fields['myfield'] : "DEFAULT VALUE!"; ?>
<input type="text" name="myfield" size="10" maxlength="15" value="<?=$val?>"/>

All the best -

Ben
Reply
#3
Hi Ben,

Many thanks for providing the answer.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)