OK Я отправляю данные с $ _POST для себя.
У меня есть флажки, которые я проверил по умолчанию. (1 & 2 в этом примере)
Когда форма sumbitted, я хочу переопределить эти значения по умолчанию с значением $ _POST.
<?php
$syndication_check_1 = 'checked="checked"';
$syndication_check_2 = 'checked="checked"';
$syndication_check_3 = '';
if (isset($_POST['syndication'])) {
//
}
?>
<form name="form" method="post" action="">
<!-- this is what I use for radiobuttons -->
<legend>Sex:</legend>
<input type="radio" name="sex" id="sex-1" value="M" <?php echo (!isset($_POST['sex']) || $_POST['sex'] == "M") ? 'checked="checked"': ''; ?> />
<label for="sex-1"><?= _("Male"); ?></label>
<input type="radio" name="sex" id="sex-2" value="F" <?php echo (isset($_POST['sex']) && $_POST['sex'] == "F") ? 'checked="checked"': ''; ?> />
<label for="sex-2"><?= _("Female"); ?></label>
<!-- now something similar for checkboxes -->
<legend>Syndication:</legend>
<input type="checkbox" name="syndication[]" id="syndication-1" value="yahoo" <?= $syndication_check_1; ?> /> <!-- checked -->
<label for="syndication-1">Yahoo Real Estate</label>
<input type="checkbox" name="syndication[]" id="syndication-2" value="trulia" <?= $syndication_check_2; ?> /> <!-- checked -->
<label for="syndication-2">Trulia.com</label>
<input type="checkbox" name="syndication[]" id="syndication-3" value="zillow" <?= $syndication_check_3; ?> />
<label for="syndication-3">Zillow.com</label>
</form>
Что вы хотите сказать? – Beaker 2010-11-30 08:21:20
да неясно – 2010-11-30 08:21:55
Как я могу переопределить свои значения по умолчанию с помощью значений данных $ _POST? – FFish 2010-11-30 08:49:34