<form action="firma.php" method="post">
<input type="submit" name="firma" value="POWRÓT DO MENU FIRMY">
</form>
<form action="index.php" method="post">
<input type="submit" name="powrot" value="POWRÓT DO MENU GŁÓWNEGO">
</form>
<?php
//conection with db
include 'db_config.php';
// Create connection
$conn = mysqli_connect($db_server, $db_user, $db_passwd, $db_name);
// Check connection
if (!$conn) {
die("Connection failed: " . mysqli_connect_error());
}
?>
<html>
<head></head>
<body>
<form action="" method="GET">
Podaj nazwę firmy <input type="varchar" name="nazwa" value=""/><br><br>
Podaj ulicę <input type="varchar" name="ulica" value=""/><br><br>
Podaj kod pocztowy <input type="varchar" name="kod_pocztowy" value=""/><br><br>
Podaj miejscowość <input type="varchar" name="miasto" value=""/><br><br>
Podaj NIP firmy <input type="varchar" name="nip" value=""/><br><br>
Podaj numer telefonu<input type="varchar" name="nr_tel" value=""/><br><br>
Podaj tabelę towarów <input type="varchar" name="tabela_towary" value=""/><br><br>
<input type="submit" name="nowafirma" value="Dodaj"/>
</form>
<?php
if ($_GET['nowafirma'])
{
$a = $_GET['nazwa'];
$b = $_GET['ulica'];
$c = $_GET['kod_pocztowy'];
$d = $_GET['miasto'];
$e = $_GET['nip'];
$f = $_GET['nr_tel'];
$g = $_GET['tabela_towary'];
if(($a!="") && ($b!="") && ($c!="") && ($d!="") && ($e!="") && ($f!="") && ($g!=""))
{
$query = "INSERT INTO firmy VALUES ('$a', '$b', '$c', '$d', '$e', '$f', '$g')";
$data = mysqli_query($conn, $query);
if($data)
{
echo "Dane dodane do bazy danych";
}
}
else
{
echo "Błąd wypełniania danych";
}
}
?>
</body>
</html>