skrypt 1 (index.php)
<form action="dodaj.php?action=add&type=song&id=" method="post"> <? if ($_GET['error']) { "style=\"color:#ff0000;background-collor:#ff0000;" . "</div><br />"; } ?> <table border="0" width="750" cellspacing="1" cellpadding="3" bgcolor="#353535" align="center"> <tr> <td bgcolor="#ffffff" width="30%">Imie:</td> <td bgcolor="#ffffff" width="70%"> <input type="text" name="imie" > </td> </tr> <tr> <td bgcolor="#ffffff" width="30%">Nazwisko</td> <td bgcolor="#ffffff" width="70%"> <input type="text" name="nazwisko" > </td> </tr> <tr> <td bgcolor="#ffffff" width="30%">Email</td> <td bgcolor="#ffffff" width="70%"> <input type="text" name="email" > </td> </tr> <tr> <td bgcolor="#ffffff" width="30%">telefon</td> <td bgcolor="#ffffff" width="70%"> <input type="text" name="telefon" > </td> </tr> <tr> <td bgcolor="#FFFFFF" colspan="2" align="center"> <input type="submit" value="Dodaj"> </td> </tr> </table> </form>
skrypt 2 (dodaj.php)
<? $error = ''; switch ($_GET['action']) { case "add"; switch ($_GET['type']){ case "telefon"; if ($_POST["email"] && $error .= "Nieprawidłowy adres e-mail."; $error .= "WYBIERZ+WYKONAWCE"; } $error .= "WYBIERZ+ROK+PREMIERY"; } $error .= "PODAJ+NAZWE+ALBUMU"; } $sql = "INSERT INTO tabela (imie, nazwisko, email, telefon) VALUES ('" . $_POST['imie'] . "', '" . $_POST['nazwisko'] . "', '" . $_POST['email'] . "', '" . $_POST['telefon'] . "')"; } else { } break; } break; } ?> <p align="center" style="color:#FF0000"> Wykonane. <a href="index.php">lista</a></p> <? } ?>