Exemplo n.º 1
0
function createBrand($db, $name, $brandGroup, $languageCode, $continent, $country, $website, $comment)
{
    $check = $db->prepare('SELECT * FROM brand WHERE name = :name');
    $check->execute(array(':name' => $name));
    if ($brandExist = $check->fetch()) {
        changeStatusBrandTable($db, $brandExist['id'], FALSE);
        changeStatusBrandTranslationTable($db, $brandExist['id'], FALSE);
        updateBrand($db, $brandExist['id'], $name, $brandGroup, $continent, $country, $website, $comment);
    } else {
        insertIntoBrandTable($db, $name, $brandGroup);
        insertIntoBrandTranslationTable($db, $db->lastInsertId(), $languageCode, $continent, $country, $website, $comment);
        header('Location: brand.php?msg=success');
    }
}
Exemplo n.º 2
0
<?php

include 'config/autoload.php';
if (!isset($_GET['id'])) {
    header('Location: brand.php');
}
$brand = getBrand($db, $_GET['id']);
if (isset($_POST['name']) and isset($_POST['brandGroup']) and isset($_POST['continent']) and isset($_POST['country']) and isset($_POST['website']) and isset($_POST['comment'])) {
    updateBrand($db, $_GET['id'], $_POST['name'], $_POST['brandGroup'], $_POST['continent'], $_POST['country'], $_POST['website'], $_POST['comment']);
    header('Location: brand.php');
}
?>

<h3>Gestion des marques</h3>

<form action="editBrand.php?id=<?php 
echo $_GET['id'];
?>
" method="post">
  <fieldset>
    <legend>Edition de la marque :</legend>
    <input type="text" name="name" value="<?php 
echo $brand['name'];
?>
" placeholder="Nom de la marque" required>*
    <input type="text" name="brandGroup" value="<?php 
echo $brand['brand_group'];
?>
" placeholder="Groupe de la marque">
    <hr>
    <input type="text" name="continent" value="<?php