Ang. opdatering:
Jeg skal have opdateret et felt som hedder titel i databasen, men jeg kan simpelthen ikke få det til at funke.SIDE 1:
<? include("tjeklogin.php"); ?>
<?php
$navn = $_SESSION['Name'];
include("functions/db_ind.inc"); ?>
<? $result = mysql_query("select * from elev
WHERE navn = '$navn'");
while ($row = mysql_fetch_array($result)) {
$elev_id = $row["elev_id"];
$navn = $row["navn"];
}
?>
<?
$result = mysql_query("select * from hp
WHERE elev_id = '$elev_id'");
while ($row = mysql_fetch_array($result)){
$bg = $row["bg"];
$title = $row["title"];
$title_color = $row["title_color"];
$indhold = $row["indhold"];
}
?>
<form action="hp2_dev2.php" method="POST">
<input name="title" type="text" value="<? echo "$title"; ?>"><br><br>
<input type="submit" name="submit" value="opdater" class="button">
</form>
SIDE 2:
<?php
$navn = $_SESSION['Name'];
include("functions/db_ind.inc"); ?>
<? $result = mysql_query("select * from elev
WHERE navn = '$navn'");
while ($row = mysql_fetch_array($result)) {
$elev_id = $row["elev_id"];
$navn = $row["navn"];
}
?>
<? $result = mysql_query("select * from hp
WHERE elev_id = '$elev_id'");
while ($row = mysql_fetch_array($result)) {
$bg = $row["bg"];
$title = $row["title"];
$title_color = $row["title_color"];
$indhold = $row["indhold"];
}
?>
<?
mysql_query ("UPDATE hp SET title='$_POST[title]' WHERE elev_id ='$elev_id'") or die(mysql_error());
?>
<?
echo "<body background=\"hp_bg/$bg\">";
echo "<h1 align=\"center\"><font color=\"$title_color\">$title</font></h1>";
echo "<p align=\"left\">$indhold</p>";
?>
Nogen der ved hvad der er galt?