test - PHP Online
Form of PHP Sandbox
*** This page was generated with the meta tag "noindex, nofollow". This happened because you selected this option before saving or the system detected it as spam. This means that this page will never get into the search engines and the search bot will not crawl it. There is nothing to worry about, you can still share it with anyone.
Enter Your PHP code here for testing/debugging in the Online PHP Sandbox. As in the usual PHP files, you can also add HTML, but do not forget to add the tag <?php
in the places where the PHP script should be executed.
Result of php executing
Full code of test.php
- <!DOCTYPE html>
- <html>
- <head>
- <title>Rennsteilnehmerverwaltung</title>
- </head>
- <body>
- <?php
- // Array für Rennsteilnehmer erstellen
- $rennsteilnehmer = array();
- // Formular zum Hinzufügen von Rennsteilnehmern anzeigen
- echo '<form action="rennsteilnehmer.php" method="post">';
- echo 'Name des Rennsteilnehmers: <input type="text" name="name"><br>';
- echo '<input type="submit" value="Rennsteilnehmer hinzufügen">';
- echo '</form>';
- // Prüfen, ob Formular abgeschickt wurde
- if(isset($_POST['name'])){
- // Rennsteilnehmer in Array hinzufügen
- array_push($rennsteilnehmer, $_POST['name']);
- // Bestätigungsnachricht anzeigen
- echo $_POST['name'] . ' wurde erfolgreich hinzugefügt.<br><br>';
- }
- // Übersicht der Rennsteilnehmer anzeigen
- echo '<h2>Rennsteilnehmer</h2>';
- if(count($rennsteilnehmer) > 0){
- // Rennsteilnehmer in Tabelle anzeigen
- echo '<table>';
- echo '<tr><th>Name</th><th>Zeit</th></tr>';
- for($i = 0; $i < count($rennsteilnehmer); $i++){
- echo '<tr>';
- echo '<td>' . $rennsteilnehmer[$i] . '</td>';
- echo '<td><input type="text" name="time"></td>';
- echo '</tr>';
- }
- echo '</table>';
- echo '<br>';
- } else {
- echo 'Es sind keine Rennsteilnehmer vorhanden.';
- }
- // Formular zum Starten des Rennens anzeigen
- echo '<form action="rennsteilnehmer.php" method="post">';
- echo '<input type="hidden" name="start" value="1">';
- echo '<input type="submit" value="Rennen starten">';
- echo '</form>';
- // Prüfen, ob Rennen gestartet wurde
- if(isset($_POST['start'])){
- // Zeitnehmung starten
- echo 'Rennen gestartet!<br><br>';
- }
- ?>
- </body>
- </html>
File Description
- test
- PHP Code
- 27 Jan-2023
- 1.59 Kb
You can Share it:
Latest PHP Pastes