This is how I build a lookup system, but it is such that when it sends it to the database. then you go to the site again to display the infomation you have been written to the page.
So must have one or other system that can fetch the latest infomation to the side, but if you click F5 to send it just infomation to the page. so must have done something that will be sent to a file.
Only if some content is not empty, and you have click on part. So just hear you on some help to do it or imitate.
I hope to only be something ajax as download infomation to the side. or jquery or similar which can just infomation by itself.
<?php
if($_SESSION["logged_in"])
{
echo "<div class=\"opslag-indhold\">";
?>
<form name="opslag" method="post" action="#">
<input type="text" name="opslag_indhold" id="del_indhold">
<input type="submit" name="opslag" value="Del" id="del">
</form>
<?php
if(isset($_POST["opslag"]))
{
if(!empty($_POST["opslag_indhold"]))
{
if($stmt = $mysqli->prepare('INSERT INTO `opslag` (`tekst`, `id_bruger`) VALUES (?, ?)'))
{
$stmt->bind_param('si', $tekst, $id_bruger);
$tekst = $_POST["opslag_indhold"];
$id_bruger = $_SESSION["id"];
$stmt->execute();
$stmt->close();
echo "Du har skrevet indhold";
}
}
else
{
echo "Du skal skrive noget";
}
}
?>
</div>
<?php
}
?>
If you have an idea please feel free to ask me
You are welcome to ask me if you want to know something?
EIDT MORE!
<?php
if($_SESSION["logged_in"])
{
echo "<div class=\"opslag-indhold\">";
?>
<form name="opslag" method="post" action="#">
<input type="text" name="opslag_indhold" id="del_indhold">
<input type="submit" name="opslag" value="Del" id="del">
</form>
<?php
if(isset($_POST["opslag"]))
{
if(!empty($_POST["opslag_indhold"]))
{
if($stmt = $mysqli->prepare('INSERT INTO `opslag` (`tekst`, `id_bruger`) VALUES (?, ?)'))
{
$stmt->bind_param('si', $tekst, $id_bruger);
$tekst = $_POST["opslag_indhold"];
$id_bruger = $_SESSION["id"];
$stmt->execute();
$stmt->close();
echo "Du har skrevet indhold";
}
}
else
{
echo "Du skal skrive noget";
}
}
?>
</div>
<?php
}
?>
here there will be posting to the page
<div class="opslag_midt-indhold">
<?php
if ($stmt = $mysqli->prepare('SELECT `tekst`, `id_bruger` FROM `opslag`ORDER BY `opslag`.`id_opslag` DESC LIMIT 15')) {
$stmt->execute();
$stmt->store_result();
$stmt->bind_result($tekst, $id_bruger);
while ($stmt->fetch())
{
?>
<div class="opslag_bruger_info_profil">
<div class="pas-indhold">
<?php
if($id_bruger == $_SESSION["id"])
{
if ($stmt_1 = $mysqli->prepare('SELECT `brugernavn`, `profilbillede`, `profilbillede_godkendt` FROM `bruger` WHERE `id_bruger` = ?'))
{
$stmt_1->bind_param('i', $id);
$id = $id_bruger;
/* Eksekver forespørgslen */
$stmt_1->execute();
/* Bind resultatet */
$stmt_1->bind_result($brugernavn, $profilbillede, $profilbillede_godkendt);
/* Hent rækker og udskriv data */
while ($stmt_1->fetch())
{
if($profilbillede_godkendt == 0)
{
echo "<a href=\"/profil/$id_bruger/\"><img src=\"/profil/users.png\" alt=\"\" height=\"115\" width=\"100\" border=\"0\"></a>";
}
else
{
echo "<a href=\"/profil/$id_bruger/\"><img src=\"/profil/$profilbillede\" alt=\"\" height=\"115\" width=\"100\" border=\"0\"></a>";
}
}
$stmt_1->close();
}
}
else
{
if ($stmt_2 = $mysqli->prepare('SELECT `brugernavn`, `profilbillede`, `profilbillede_godkendt` FROM `bruger` WHERE `id_bruger` = ?'))
{
$stmt_2->bind_param('i', $id);
$id = $id_bruger;
/* Eksekver forespørgslen */
$stmt_2->execute();
/* Bind resultatet */
$stmt_2->bind_result($brugernavn, $profilbillede, $profilbillede_godkendt);
/* Hent rækker og udskriv data */
while ($stmt_2->fetch())
{
if($profilbillede_godkendt == 0)
{
echo "<a href=\"/profil/$id_bruger/\"><img src=\"/profil/users.png\" alt=\"\" height=\"115\" width=\"100\" border=\"0\"></a>";
}
else
{
echo "<a href=\"/profil/$id_bruger/\"><img src=\"/profil/$profilbillede\" alt=\"\" height=\"115\" width=\"100\" border=\"0\"></a>";
}
}
$stmt_2->close();
}
}
?>
<?php echo $tekst;?>
</div>
</div>
<?php
}
$stmt->close();
} else {
echo 'Der opstod en fejl i erklæringen: ' . $mysqli->error;
}
?>
</div>