pdo statements
Blindmenü-edit
bmenu.php
Sprung variable setzen
if($jumpi=='brecht')
{
Post
echo'<form method="post" action="index.php?page=99&jump=3&jumpi=brecht&bmen_id='.$bmen_id.'">';
echo'<table class="tables faces">';
echo'<tr>';
echo'<th colspan="2">Blind-Menü Edit</th>';
echo'</tr>';
Datenbank abfrage
$stmt = $pdo->prepare("SELECT id,labels,ziels,linken_url FROM blind_menu WHERE id=:id");
$stmt->bindParam(':id',$bmen_id,PDO::PARAM_INT);
$stmt->bindColumn(1,$bmen_id);
$stmt->bindColumn(2,$m_labels);
$stmt->bindColumn(3,$m_ziels);
$stmt->bindColumn(4,$m_links);
$stmt->execute();
Daten ausgabe
while($stmt->fetch())
{
echo'<tr>';
echo'<td>ID:</td>';
echo'<td>';
echo'<input class="form-controle" type="text" name="ids" value="'.$bmen_id.'">';
echo'</td>';
echo'</tr>';
echo'<tr>';
echo'<td>Menüname:</td>';
echo'<td>';
echo'<input class="form-controle" type="text" name="labels" value="'.$m_labels.'">';
echo'</td>';
echo'</tr>';
echo'<tr>';
echo'<td >wohin:</td>';
echo'<td>';
echo'<input class="form-controle" type="text" name="linksurl" value="'.$m_links.'">';
echo'</td>';
echo'</tr>';
}
echo'<td>';
echo'<input class="butli button-blue" type="submit" name="labelsneu" value="Speichern">';
echo'</td>';
echo'<td>';
echo'<button class="butli" type="submit" formaction="index.php?page=99&jump=3&jumpi=blind">zurück</button>';
echo'</td>';
echo'</table>';
echo'</form>';
Sprungmarke setzen
if(isset($_POST['labelsneu']))
{
$id = $bmen_id;
Post Daten
$labels = isset($_POST['labels']) ? $_POST['labels'] : '';
$linksurl = isset($_POST['linksurl']) ? $_POST['linksurl'] : '';
Datenbank aktualisieren
$stmt = $pdo->prepare("UPDATE blind_menu SET labels=:label,ziels=:ziel,linken_url=:linkurl WHERE id=:id");
$stmt->bindParam(':id',$id,PDO::PARAM_INT);
$stmt->bindParam(':label',$labels,PDO::PARAM_STR);
$stmt->bindParam(':ziel',$id,PDO::PARAM_INT);
$stmt->bindParam(':linkurl',$linksurl,PDO::PARAM_STR);
if($stmt->execute())
{
header("Location:index.php?page=99&jump=3&jumpi=blind");
}
else
{
echo"Da ist was schief gelaufen";
}
Sprung variablen ende
}
}
Top
Top