Hauptmenü-insert
hmenu.php
Sprung variable setzen
if($jumpi=='new')
{
{
Tabellenkopf
echo'<table class="table">';
echo'<tr>';
echo'<th colspan="6">Haupt-Menü</th>';
echo'</tr>';
echo'<tr class="big">';
echo'<td>ID</td>';
echo'<td>Menüname</td>';
echo'<td>wohin</td>';
echo'<td>paarID</td>';
echo'</tr>';
echo'<tr>';
echo'<th colspan="6">Haupt-Menü</th>';
echo'</tr>';
echo'<tr class="big">';
echo'<td>ID</td>';
echo'<td>Menüname</td>';
echo'<td>wohin</td>';
echo'<td>paarID</td>';
echo'</tr>';
Datenbank abfrage
$stmt = $pdo->prepare("SELECT id,label,ziel,link_url,parent_id FROM test_menu ORDER BY id");
$stmt->bindColumn(1,$mem_id);
$stmt->bindColumn(2,$m_label);
$stmt->bindColumn(3,$m_ziel);
$stmt->bindColumn(4,$m_link);
$stmt->bindColumn(5,$m_parid);
$stmt->execute();
$stmt->bindColumn(1,$mem_id);
$stmt->bindColumn(2,$m_label);
$stmt->bindColumn(3,$m_ziel);
$stmt->bindColumn(4,$m_link);
$stmt->bindColumn(5,$m_parid);
$stmt->execute();
Daten ausgabe
while($stmt->fetch())
{
echo'<tr>';
echo'<td>'.$mem_id.'</td>';
echo'<td>'.$m_label.'</td>';
echo'<td>'.$m_link.'</td>';
echo'<td>'.$m_parid.'</td>';
echo'</tr>';
}
{
echo'<tr>';
echo'<td>'.$mem_id.'</td>';
echo'<td>'.$m_label.'</td>';
echo'<td>'.$m_link.'</td>';
echo'<td>'.$m_parid.'</td>';
echo'</tr>';
}
echo'</table>';
Sprung variable in Sprung variable setzen
if($jumps=='neu')
{
{
Dateikopf
echo'<div class="bigg">Menüpunkt erstellen</div>';
echo'<form action="index.php?page=99&jump=2&jumpi=write&jumps=schreib" method="post">';
echo'<input name="jumps" type="hidden" value="schreib">';
echo'<div class="form-face">';
echo'<input required="required" placeholder=" ID:" class="form-control" name="id" type="text">';
echo'</div>';
echo'<div class="form-face">';
echo'<input required="required" placeholder=" Menüname:" class="form-control" name="label" type="text">';
echo'</div>';
echo'<div class="form-face">';
echo'<input required="required" placeholder=" wohin:" class="form-control" name="linkurl" type="text">';
echo'</div>';
echo'<div class="form-face">';
echo'<input required="required" placeholder=" PaarID:" class="form-control" name="parentid" type="text">';
echo'</div>';
echo'<div class="form-face">';
echo'<input type="submit" name="schreib" value="Menüpunkt erstellen" class="butt button-blue">';
echo'<input type="reset" value="Löschen" class="butt button-red">';
echo'</div>';
echo'</form>';
echo'<form action="index.php?page=99&jump=2&jumpi=write&jumps=schreib" method="post">';
echo'<input name="jumps" type="hidden" value="schreib">';
echo'<div class="form-face">';
echo'<input required="required" placeholder=" ID:" class="form-control" name="id" type="text">';
echo'</div>';
echo'<div class="form-face">';
echo'<input required="required" placeholder=" Menüname:" class="form-control" name="label" type="text">';
echo'</div>';
echo'<div class="form-face">';
echo'<input required="required" placeholder=" wohin:" class="form-control" name="linkurl" type="text">';
echo'</div>';
echo'<div class="form-face">';
echo'<input required="required" placeholder=" PaarID:" class="form-control" name="parentid" type="text">';
echo'</div>';
echo'<div class="form-face">';
echo'<input type="submit" name="schreib" value="Menüpunkt erstellen" class="butt button-blue">';
echo'<input type="reset" value="Löschen" class="butt button-red">';
echo'</div>';
echo'</form>';
Sprung variablen ende
}
}
}
Menüpunkt eintragen
Sprung variable setzen
if($jumpi=='write')
{
{
Sprung variable in Sprung variable setzen
if($jumps=='schreib')
{
{
$_POST Dateien
$wid=isset($_POST['id']) ? $_POST['id'] : '';
$wlabel=isset($_POST['label']) ? $_POST['label'] : '';
$wlinkurl=isset($_POST['linkurl']) ? $_POST['linkurl'] : '';
$wparentid=isset($_POST['parentid']) ? $_POST['parentid'] : '';
$wlabel=isset($_POST['label']) ? $_POST['label'] : '';
$wlinkurl=isset($_POST['linkurl']) ? $_POST['linkurl'] : '';
$wparentid=isset($_POST['parentid']) ? $_POST['parentid'] : '';
In Datenbank schreiben
$stmt = $pdo->prepare ("INSERT INTO test_menu (id, label, ziel, link_url, parent_id ) VALUES (:id,:label,:ziel,:linkurl,:parentid)");
$stmt->bindParam(':id',$wid,PDO::PARAM_INT);
$stmt->bindParam(':label',$wlabel,PDO::PARAM_STR);
$stmt->bindParam(':ziel',$wid,PDO::PARAM_INT);
$stmt->bindParam(':linkurl',$wlinkurl,PDO::PARAM_STR);
$stmt->bindParam(':parentid',$wparentid,PDO::PARAM_INT);
if($stmt->execute())
{
header("Location:index.php?page=99&jump=2&jumpi=show");
}
else
{
echo"Da ist was schief gelaufen";
}
$stmt->bindParam(':id',$wid,PDO::PARAM_INT);
$stmt->bindParam(':label',$wlabel,PDO::PARAM_STR);
$stmt->bindParam(':ziel',$wid,PDO::PARAM_INT);
$stmt->bindParam(':linkurl',$wlinkurl,PDO::PARAM_STR);
$stmt->bindParam(':parentid',$wparentid,PDO::PARAM_INT);
if($stmt->execute())
{
header("Location:index.php?page=99&jump=2&jumpi=show");
}
else
{
echo"Da ist was schief gelaufen";
}
Sprung variablen ende
}
}
}