3v4l.org

run code in 300+ PHP versions simultaneously
<!DOCTYPE html> <html> <head lang="de"> <title>Anschrift</title> <meta charset="UTF-8"> <script type="text/javascript"> function showadressfield(participant) { if ( document.getElementById("check"+participant).checked == true ) { document.getElementById("adresse"+participant).style.display ="inline"; } else { document.getElementById("adresse"+participant).style.display ="none"; } } </script> </head> <body> <?php for ($participants=1;$participants<=5;$participants++){ echo 'Teilnehmer '.$participants.' <br><input type="text" name="addresse" placeholder="Name"> <br>abweichende Anschrift <input type="checkbox" id="check'.$participants.'" onClick="showadressfield('.$participants.')"><br> <div style="display:none" id="adresse'.$participants.'" > <input type="text" name="addresse" placeholder="Adresse"><br> <input type="text" name="plz" placeholder="Postleitzahl"> </div><br><hr>'; }; ?> </body> </html>
Output for 4.3.0 - 4.3.11, 4.4.0 - 4.4.9, 5.0.0 - 5.0.5, 5.1.0 - 5.1.6, 5.2.0 - 5.2.17, 5.3.0 - 5.3.29, 5.4.0 - 5.4.45, 5.5.0 - 5.5.38, 5.6.0 - 5.6.38, 7.0.0 - 7.0.33, 7.1.0 - 7.1.25, 7.2.0 - 7.2.33, 7.3.0 - 7.3.33, 7.4.0 - 7.4.33, 8.0.0 - 8.0.30, 8.1.0 - 8.1.28, 8.2.0 - 8.2.18, 8.3.0 - 8.3.6
<!DOCTYPE html> <html> <head lang="de"> <title>Anschrift</title> <meta charset="UTF-8"> <script type="text/javascript"> function showadressfield(participant) { if ( document.getElementById("check"+participant).checked == true ) { document.getElementById("adresse"+participant).style.display ="inline"; } else { document.getElementById("adresse"+participant).style.display ="none"; } } </script> </head> <body> Teilnehmer 1 <br><input type="text" name="addresse" placeholder="Name"> <br>abweichende Anschrift <input type="checkbox" id="check1" onClick="showadressfield(1)"><br> <div style="display:none" id="adresse1" > <input type="text" name="addresse" placeholder="Adresse"><br> <input type="text" name="plz" placeholder="Postleitzahl"> </div><br><hr>Teilnehmer 2 <br><input type="text" name="addresse" placeholder="Name"> <br>abweichende Anschrift <input type="checkbox" id="check2" onClick="showadressfield(2)"><br> <div style="display:none" id="adresse2" > <input type="text" name="addresse" placeholder="Adresse"><br> <input type="text" name="plz" placeholder="Postleitzahl"> </div><br><hr>Teilnehmer 3 <br><input type="text" name="addresse" placeholder="Name"> <br>abweichende Anschrift <input type="checkbox" id="check3" onClick="showadressfield(3)"><br> <div style="display:none" id="adresse3" > <input type="text" name="addresse" placeholder="Adresse"><br> <input type="text" name="plz" placeholder="Postleitzahl"> </div><br><hr>Teilnehmer 4 <br><input type="text" name="addresse" placeholder="Name"> <br>abweichende Anschrift <input type="checkbox" id="check4" onClick="showadressfield(4)"><br> <div style="display:none" id="adresse4" > <input type="text" name="addresse" placeholder="Adresse"><br> <input type="text" name="plz" placeholder="Postleitzahl"> </div><br><hr>Teilnehmer 5 <br><input type="text" name="addresse" placeholder="Name"> <br>abweichende Anschrift <input type="checkbox" id="check5" onClick="showadressfield(5)"><br> <div style="display:none" id="adresse5" > <input type="text" name="addresse" placeholder="Adresse"><br> <input type="text" name="plz" placeholder="Postleitzahl"> </div><br><hr> </body> </html>

preferences:
349.42 ms | 413 KiB | 423 Q