Hej,
Jeg arbejder på min første website, hvor brugerne har mulighed for at oprette sig, se deres profil og ændre deres profil.
Jeg kan ikke få databasen til at updatere med de rigtige oplysninger, når de har udfyldt formularen.
Det som sker da jeg trykker på gem profil, er at feltet i databasen står blankt..
edit_profil.php
<?php
include ("../includes/session.php");
include ("../includes/functions.php");
require_once("../includes/connection.php");
confirm_logged_in();
?>
<?php
$query = mysql_query("SELECT * FROM users where id = '$_SESSION[id]' ");
while ($row = mysql_fetch_array($query)) {
$id = $row ['id'];
$username = $row ['username'];
$first_name = $row ['first_name'];
$last_name = $row ['last_name'];
$city = $row ['city'];
$date = $row ['date'];
$age = $row ['age'];
$country = $row ['country'];
$about_me = $row ['aboutme'];
}
?>
<?php include("../includes/header.php"); ?>
<?php include("../includes/member_left_menu.php"); ?>
<div id="member_content">
<h2>Oplysninger om dig</h2>
<form action="edit_profile_succes.php" method="POST">
<table>
<tr>
<td>Brugernavn:</td>
<td><input type="text" name="change_username" value="<?php echo $username ?>"> </td>
</tr>
<tr>
<td>Fornavn:</td>
<td><input type="text" name="change_first_name" value="<?php echo $first_name ?>"></td>
</tr>
<tr>
<td>Efternavn:</td>
<td><input type="text" name="change_last_name" value="<?php echo $last_name ?>"></td>
</tr>
<tr>
<td>By:</td>
<td><input type="text" name="change_city" value="<?php echo $city ?>"></td>
</tr>
<tr>
<td>Alder:</td>
<td><input type="text" name="change_age" value="<?php echo $age ?>"></td>
</tr>
<tr>
<td>Land:</td>
<td><input type="text" name="change_country" value="<?php echo $country ?>"></td>
</tr>
<tr>
<td>Om mig:</td>
<td><textarea name="about_me" cols="35" rows="10"><?php echo $about_me ?> </textarea></td>
</tr>
</table>
<p />
<input type="submit" name="submit" value="Gem">
</form>
</div>
<?php include("../includes/footer.php");
edit_profile_succes.php
<?php
include ("../includes/session.php");
include ("../includes/functions.php");
require_once("../includes/connection.php");
confirm_logged_in();
?>
<?php
$update_profile = mysql_query("UPDATE users SET username='$username' WHERE id = '$_SESSION[id]'");
include ("../includes/header.php");
echo "Din bruger er nu opdateret";
include ("../includes/footer.php");
?>
Håber der er nogen der kan hjælpe. :)