9 Years
Discussion Span
Last Post by Mike_H

I am searching for a script that retains both text and checkbox field values like the script at: www.dynamicdrive.com/dynamicindex16/formremember2.htm
An ASP or Java script would work best.

You do it with reading the values back from your database and using "Value" for input boxes, "Selected" for drop down boxes, and "Checked" for check boxes and radio boxes.

Here is a sample of my code I am using on a web site I have designed using PHP. It will be similar in other web design languages.

<select name="Salutation" class="required" id="Salutation" tabindex="1" size="1" style="font-size: 1.6em" /><span id="errmsg"></span>
	<option value=""></option>
	<option value="Mrs." <?php if ($Salutation == 'Mrs.')  echo ' selected="selected"'; ?>>Mrs.</option>
	<option value="Miss" <?php if ($Salutation == 'Miss')  echo ' selected="selected"'; ?>>Miss</option>
	<option value="Ms." <?php if ($Salutation == 'Ms.')  echo ' selected="selected"'; ?>>Ms.</option>
	<option value="Mr." <?php if ($Salutation == 'Mr.')  echo ' selected="selected"'; ?>>Mr.</option>

<label for="FName">First Name:<span class="red">*</span></label>
<input type="text" id="FName" class="required" name="FName" size="30" maxlength="30" tabindex="2" value="<? echo $FName; ?>" />

<label for="State" id="State">State:<span class="red">*</span></label>
	<select  name="State" size="1" tabindex="6" style="font-size: 1.6em">
	<option value="AR"<?php if ($State == 'AR')  echo ' selected="selected"'; ?>>Arkansas</option>
	<option value="AL"<?php if ($State == 'AL')  echo ' selected="selected"'; ?>>Alabama</option>
	<option value="AK"<?php if ($State == 'AK')  echo ' selected="selected"'; ?>>Alaska</option>

<span id="label_credit">Are you taking this course to receive credit?<span class="red">*</span></span>
	<label for="no">No&nbsp;<input type="radio" name="Credit" id="no" VALUE="N" class="required" onclick="enable_submit()" <?php if (strtoupper($Credit) == 'N')  echo ' checked="checked"'; ?> /></label>
	<label for="yes">Yes&nbsp;<input type="radio" name="Credit" id="yes" VALUE="Y" onclick="enable_submit()" <?php if (strtoupper($Credit) == 'Y')  echo ' checked="checked"'; ?>/></label>

<span id="label_cancel">I will not be able to attend. Please cancel my registration.	<input type="checkbox" name="Cancel" onclick="enable_submit()" value="Y" <?php if (strtoupper($Cancel) == 'Y')  echo 'checked="checked"'; ?>/></span><p></p>
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.