Kod na pewno jest beznadziejny ale chciałbym zaznaczyć, że dopiero uczę się PHP :-)
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1250" />
<title>Projekt bazy danych</title>
<link rel="stylesheet" type="text/css" href="styl.css" />
</head>
<body>
<div id="h2">
<form action="formularz.php" method="post">
<p align="right">
<input type ="hidden" name="wybor" value="dodaj">
<table>
id klienta:<input type ="text" name="id"><br />
imie:<input type ="text" name="imie"><br />
nazwisko:<input type ="text" name="nazwisko"><br />
nazwa firmy:<input type ="text" name="nazwa_firmy"><br />
telefon:<input type ="text" name="telefon"><br />
<input type ="submit" value="dodaj">
</table>
</p>
</form>
</div>
<?php
mysql_connect("localhost", "xxxxx", "yyyyy") or
die ("Nie można połączyć się z bazą"); echo '<form action= "formularz.php" method="get">'; echo '<input type ="hidden" name="wybor" value="szukaj">'; echo '<input type= "text" name="napis">'; echo '<input type= "submit" value="Szukaj imie">';
echo '<form action= "formularz.php" method="get">'; echo '<input type ="hidden" name="wybor" value="DEL">'; echo 'Id_klienta:<input type= "text" name="Id">'; echo '<input type= "submit" value="Usun">';
$sql = "DELETE from Klienci where id=1;";
if(isset($_POST["wybor"])== 'dodaj') {
$imie1=$_POST['imie'];
$nazwisko1=$_POST['nazwisko'];
$nazwa1=$_POST['nazwa_firmy'];
$telefon1=$_POST['telefon'];
if($imie1 and $nazwisko1 and $nazwa1 and $telefon1)
{
$ins =mysql_query("insert into klienci set imie='$imie1', nazwisko='$nazwisko1', nazwa_firmy='$nazwa1',telefon='$telefon1'"); if($ins) echo "Rekord został dodany poprawnie"; else echo "Błąd nie udało się dodać nowego rekordu"; }
}
/*else if (isset($_GET["Id"]))
{
$zapytanie3="DELETE from Klienci where id='$_GET[Id]';";
if ($_GET["wybor"] == 'DEL')
{
echo 'Brak bledu';
{
echo '<h5>blad</h5>';
}
}
}
*/
else if (isset($_GET["napis"])) {
$zapytanie2="SELECT *from klienci where imie='$_GET[napis]'";
if ($_GET["wybor"]== 'szukaj')
{
{
echo ("<h1><b>Znaleziono</b></h1>"); //echo '<div id="h6">';
echo "<table cellpading=5 border=2>"; echo "<td><b>Id_klienta</td></b>"; echo "<td><b>Imie</td></b>"; echo "<td><b>Nazwisko</td></b>"; echo "<td><b>Nazwa firmy</td></b>"; echo "<td><b>Telefon</td></b>"; }
else echo ("<h1><b>Nie ma</b></h1>");
{
$id2 =$rek[0];
$imie2=$rek[1];
$nazwisko2=$rek[2];
$nazwa_firmy2=$rek[3];
$telefon2=$rek[4];
echo "<td><b>$id2</td></b>"; echo "<td><b>$imie2</td></b>"; echo "<td><b>$nazwisko2</td></b>"; echo "<td><b>$nazwa_firmy2</td></b>"; echo "<td><b>$telefon2</td></b>"; //echo '</div>';
}
echo '<a href ="formularz.php"> Powrot do formularza</a>';
}
}
$zapytanie1 = "SELECT *from klienci";
//echo '<div id="h4">';
echo "<table cellpading=5 border=2>"; echo "<td><b>Id_klienta</td></b>"; echo "<td><b>Imie</td></b>"; echo "<td><b>Nazwisko</td></b>"; echo "<td><b>Nazwa firmy</td></b>"; echo "<td><b>Telefon</td></b>";
{
$id =$rekord[0];
$imie=$rekord[1];
$nazwisko=$rekord[2];
$nazwa_firmy=$rekord[3];
$telefon=$rekord[4];
echo "<td><b>$id</td></b>"; echo "<td><b>$imie</td></b>"; echo "<td><b>$nazwisko</td></b>"; echo "<td><b>$nazwa_firmy</td></b>"; echo "<td><b>$telefon</td></b>"; //echo "<td><a href = \"formularz.php?wybor=usun&id=&id\">kasuj</a></td>";
}
//echo '</div>';
?>
</body>
</html>