Documente Academic
Documente Profesional
Documente Cultură
<?php
// Se deschide conexiunea
$con = mysqli_connect($host, $username, $password, $database);
Un formular trimite anumite date, prin variabile, către pagina setata în action, folosind metoda
specificată în method, GET sau POST.
<?php
$profesor = $_GET["profesor"];
if(ISSET($profesor)) {
?>
FORMULAR DE INSERARE – fișier: insert.php
<?php
$furnizor = $_POST["furnizor"];
$cui = $_POST["cui"];
$adresa = $_POST["adresa"];
$email = $_POST["email"];
if (mysqli_query($con, $sql_insert)) {
echo "A fost adăugată o nouă înregistrare.";
} // IF MYSQLI
mysqli_close($con);
} // IF ISSET
?>
FORMULAR DE SELECȚIE – fișier: select.php
<?php
$furnizor = $_GET["furnizor"];
if (mysqli_num_rows($rezultat) > 0) {
while($rand = mysqli_fetch_assoc($rezultat)) {
echo $rand["denumire"]. "<br>";
} // Se închide WHILE
} // Se închide IF
else {
echo "Nu a fost găsit niciun rezultat.";
} // Se închide ELSE
mysqli_close($con);
} // Se închide IF ISSET
?>