PHP gevorderde |
|
omdat ze allemaal de naam kennis[] bevaten.
Probeer dit eens.
java: <input type="checkbox" name="java" ></input>
php: <input type="checkbox" name="php" ></input>
c++: <input type="checkbox" name="cpp" ></input>
dhtml: <input type="checkbox" name="dhtml" ></input>
xml: <input type="checkbox" name="xml" ></input>
java: <input type="checkbox" name="java" ></input> php: <input type="checkbox" name="php" ></input> c++: <input type="checkbox" name="cpp" ></input> dhtml: <input type="checkbox" name="dhtml" ></input> xml: <input type="checkbox" name="xml" ></input>
<?php
$returnString = "";
$new = 0
if (isset($_POST['java'])) {
$returnString = $returnString."Java";
$new = 1;
}
if (isset($_POST['php'])) {
if ($new == 1) {
$returnString = $returnString.", PHP";
$new = 0;
} else {
$returnString = $returnString."PHP";
$new = 0;
}
$new = 1;
}
if (isset($_POST['cpp'])) {
if ($new == 1) {
$returnString = $returnString.", C++";
$new = 0;
} else {
$returnString = $returnString."C++";
$new = 0;
}
$new = 1;
}
if (isset($_POST['dhtml'])) {
if ($new == 1) {
$returnString = $returnString.", DHTML";
$new = 0;
} else {
$returnString = $returnString."DHTML";
$new = 0;
}
$new = 1;
}
if (isset($_POST['xml'])) {
if ($new == 1) {
$returnString = $returnString.", XML";
$new = 0;
} else {
$returnString = $returnString."XML";
$new = 0;
}
$new = 1;
}
if ($returnString != "") {
echo "Kennis van/ervaring met: ".$returnString.".";
} else {
echo "Kennis van/ervaring met: niks.";
}
?>
<?php $returnString = ""; $new = 0 if (isset($_POST['java'])) { $returnString = $returnString."Java"; $new = 1; } if (isset($_POST['php'])) { if ($new == 1) { $returnString = $returnString.", PHP"; $new = 0; } else { $returnString = $returnString."PHP"; $new = 0; } $new = 1; } if (isset($_POST['cpp'])) { if ($new == 1) { $returnString = $returnString.", C++"; $new = 0; } else { $returnString = $returnString."C++"; $new = 0; } $new = 1; } if (isset($_POST['dhtml'])) { if ($new == 1) { $returnString = $returnString.", DHTML"; $new = 0; } else { $returnString = $returnString."DHTML"; $new = 0; } $new = 1; } if (isset($_POST['xml'])) { if ($new == 1) { $returnString = $returnString.", XML"; $new = 0; } else { $returnString = $returnString."XML"; $new = 0; } $new = 1; } if ($returnString != "") { echo "Kennis van/ervaring met: ".$returnString."."; } else { echo "Kennis van/ervaring met: niks."; } ?>
|