-1

When I submit html form to php, it displays my code instead of executing it. I'm using XAMPP server. I have Apache and MySQL turned on. I tried reinstalling XAMPP, but it does not help. Here's what browser displays: browser screen

And here's my html code:

<html>
    <head>
        <title>Dodawanie danych do tabeli uczen</title>
        <link rel="stylesheet" href="plik.css">
    </head>
    
    <body>
        <div class="box">
            <h2>Dodaj pracownika:</h2>
            <form action="dodaj.php" method="post">
                Nr oddziału: <input class="pole" type="text" name="numer_oddzialu"><br>
                Nazwa oddziału: <input type="text" name="nazwa_oddzialu"><br>
                Miejscowość: <input type="text" name="miejscowosc_oddzialu"><br>
                Adres: <input type="text" name="adresc_oddzialu"><br>
                Pesel: <input type="int" name="pesel"><br>
                Imię: <input type="text" name="imie"><br>
                Nazwisko: <input type="text" name="nazwisko"><br>
                Stanowisko: <input type="text" name="stanowisko"><br>
                Wynagrodzenie: <input type="int" name="wynagrodzenie"><br>
                <input type="submit" value="wyslij">
            </form>
            <a href="baza.php">Wyswietl wszystkich</a>
        </div>
    </body>
</html>

Please help!!!

Ofiec
  • 5
  • 5
  • You are not running through a web server you are running the page from disk. PHP cannot execute unless you run the page through a properly configured web server with PHP – RiggsFolly Feb 02 '21 at 15:01
  • Please [learn to love labels](http://www.456bereastreet.com/archive/200711/use_the_label_element_to_make_your_html_forms_accessible/) – Quentin Feb 02 '21 at 15:02

1 Answers1

1

PHP (in this context) is a server-side programming language.

You tagged this but you aren't using it. Your URL (in the screenshot) starts with file://.

You need to load the HTML document by accessing it through your web server (by typing http://etc in the address bar and not by double clicking the HTML file in Windows Explorer.

Quentin
  • 914,110
  • 126
  • 1,211
  • 1,335