OK Ich sende Daten mit $ _POST an sich.
Ich habe einige Kontrollkästchen, die ich standardmäßig aktiviert habe. (1 & 2 in diesem Beispiel)
Wenn das Formular gesendet wird, möchte ich diese Standardwerte mit dem $ _POST-Wert überschreiben.
<?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>
Was ist Ihre Frage? – Beaker
Ja, es ist nicht klar –
Wie kann ich meine Standardwerte mit den $ _POST Datenwerten überschreiben? – FFish