To ma być formularz dodający imie, nazwisko i maila do bazy. W przypadku nie uszupełnienia jakiegoś pola ma wyświetlać błąd. niestety po naciśnięciu submit nic się nie dzieje.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> <meta http-equiv="content-type" content="text/html; charset=UTF-8" /> <title>Formularz</title> <link rel="stylesheet" type="text/css" href="style.css" /> </head> <body> <p>Wpisz dane:</p> <?php $nazwisko = $_POST['imie']; $imie = $_POST['nazwisko']; $email = $_POST['mail']; $test = 'no'; // Sprawdzam czy któreś pole jest puste $test = 'yes'; } } else { $test = 'yes'; } $dbc = mysqli_connect('localhost', 'uzyt', 'haslo', 'mailing') $query = "INSERT INTO lista (imie, nazwisko, mail) VALUES ('$imie', '$nazwisko', '$mail')"; mysqli_query($dbc, $query) mysqli_close($dbc); } if ($test == 'yes') { ?> <label for="imie">Imię:</label> <input type="text" id="imie" name="imie" /><br /> <label for="nazwisko">Nazwisko:</label> <input type="text" id="nazwisko" name="nazwisko" /><br /> <label for="mail">Adres e-mail:</label> <input type="text" id="mail" name="mail" /><br /> <input type="submit" name="Submit" value="Wyślij" /> </form> <?php } ?> </body> </html>