Forum Moderators: coopster & phranque

Message Too Old, No Replies

Need to set a value as default in form

Quick ammendment

         

litmania

10:12 pm on Aug 28, 2001 (gmt 0)



The sign-up form we have for our ezine created automatically by our mailing list programme gives the person an option to pick Text/HTML version. We wish to only have a HTML edition.

Here's the code:


Format: <select name=format><option value=0>Text</option><option value=1>HTML</option></select>

How can we set the default to value=1 and not give the person an option?

Do we add the value to the action command i.e.:


<form action="http://www.mydomain.com/maxemail/join.php">

?

Thank you very much for your help :)

(edited by: sugarkane at 10:15 pm (gmt) on Aug. 28, 2001

sugarkane

10:20 pm on Aug 28, 2001 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



<note>
The edit above was just to 'anonymise' the domain you gave ;)
</note>

To select an option field as default you'd use

<option value=1 selected>HTML</option>

If you wanted to avoid giving the option altogether, remove the whole <select></select> and use a hidden field:

<input type="hidden" name="format" value="HTML">

You don't need to modify the <form> tag.

litmania

10:24 pm on Aug 28, 2001 (gmt 0)



Sugarkane - I think your editing is a bit harsh ;) - but thanks VERY much for the quick response. Works great :)

msr986

10:25 pm on Aug 28, 2001 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



<input type=hidden name=format value=1>

<added>
Beaten to the punch!

But it should be value=1, according tho the example!
</added>