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
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:

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

Thanks in advance!
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 -

Hi Ben,

Many thanks for providing the answer.

Forum Jump:

Users browsing this thread: 1 Guest(s)