opdatering af poster i Mysql
Når jeg trykker på edit_submit, vil den ikke gå ind på de sider jeg beder den om, den åbner bare den samme side igen(login_editprofil.php)Hvad har jeg lavet forkert?
<html>
<script language="JavaScript">
function co(element,mode) {
if (mode=="in") {
cursortype = 'Hand'
colorval = '#333333'
} else if (mode=="out") {
cursortype = ''
colorval = '#E6DAC8'
}
element.style.background=colorval;
element.style.cursor=cursortype;
}
</script>
<style type="text/css">
<!--
a.menu:link { text-decoration: none; color: #333333 }
a:link { text-decoration: none; color: #95C4EB }
a:visited { text-decoration: none; color: #95C4EB }
a.menu:visited { text-decoration: none; color: #333333 }
a:hover { text-decoration: none; color: #95C4EB }
a.menu:hover { text-decoration: none; color: #95C4EB }
--{
scrollbar-face-color : #3F552B;
scrollbar-shadow-color : #000000;
scrollbar-highlight-color : #666666;
scrollbar-3dlight-color : #212F20;
scrollbar-darkshadow-color : #000000;
scrollbar-track-color : #080808;
scrollbar-arrow-color : #CCCCCC;
-->
</style>
<head>
<title>Nordfyns Ungdomsskole [NFU] - årgang 2000/2001 !</title>
</head>
<body bgcolor="#000000" text="#95C4EB">
<p align="center"> </p>
<div align="center">
<center>
<table border="0" width="724" cellspacing="0" cellpadding="0" height="10">
<tr>
<td width="100%" height="15">
<p align="center">
</td>
</tr>
</table>
</center>
</div>
<div align="center">
<table border="1" width="724" cellpadding="0" cellspacing="0" height="25" bgcolor="#E6DAC8" bordercolor="#333333">
<tr>
<td width="185" height="33" bgcolor="#333333" bordercolor="#333333">
<p align="center"><font face="Verdana" size="2" color="#ffffff">
<script type="text/javascript">
<!-- Dette script og mange flere -->
<!-- findes hos http://www.html.dk -->
<!-- Start
var days=new Array(8);
days[0]="Søndag";
days[1]="Mandag";
days[2]="Tirsdag";
days[3]="Onsdag";
days[4]="Torsdag";
days[5]="Fredag";
days[6]="Lørdag";
var months=new Array(13);
months[1]="januar";
months[2]="februar";
months[3]="marts";
months[4]="april";
months[5]="maj";
months[6]="juni";
months[7]="juli";
months[8]="august";
months[9]="september";
months[10]="oktober";
months[11]="november";
months[12]="december";
var time=new Date();
var lmonth=months[time.getMonth() + 1];
var lday=days[time.getDay()];
var date=time.getDate();
var year=time.getFullYear();
var hours=time.getHours();
var minutes=time.getMinutes();
var seconds=time.getSeconds();
document.write("<p>" + lday + " den ");
document.write(date + ". " + lmonth + " " + year);
// Slut -->
</script>
</font>
</td>
<td width="533" height="33">
<div align="center"><font color="#192537" face="Verdana"><b>[NFU] - Årgang 2000/2001 - [NFU]</b></font></div>
</td>
</tr>
</table>
</div>
<div align="center">
<center>
<table border="0" width="724" cellspacing="0" cellpadding="0" height="15">
<tr>
<td width="100%"> </td>
</tr>
</table>
</center>
</div>
<div align="center">
<table border="0" width="724" bordercolor="#333333" cellspacing="0" cellpadding="0" style="border-collapse: collapse" height="350">
<tr>
<td width="97" bgcolor="#E6DAC8" valign="top" height="350">
<table cellspacing="0" bgcolor="#333333" width="186" height="245" style="border-collapse: collapse" border="1" bordercolor="#333333">
<tr>
<td bgcolor="#333333" height="35" width="182"><b>
<font color="#FFFFFF" face="Verdana"> </font><font color="#E6DAC8" face="Verdana">Menu:</font></b></td>
</tr>
<tr>
<td bgcolor="#E6DAC8" height="42" width="182">
<font face="Verdana"><a href="../index.htm" class="menu">[Forside]
</td>
</tr>
<tr>
<td bgcolor="#E6DAC8" height="42" width="182">
<font face="Verdana"><a href="login_profiloverview.php" class="menu">[Elev info]</a></td>
</tr>
<tr>
<td bgcolor="#E6DAC8" height="42" width="182">
<font face="Verdana"><a href="../fester.htm" class="menu">[Fester]</a></td>
</tr>
<tr>
<td bgcolor="#E6DAC8" height="42" width="182">
<font face="Verdana"><a href="../par.htm" class="menu">[Parliste /
Scoreliste]</a></td>
</tr>
<tr>
<td bgcolor="#E6DAC8" height="42" width="182">
<font face="Verdana"><a href="../sange.htm" class="menu">[Sange]</a></td>
</tr>
</table>
<table cellspacing="0" bgcolor="#E6DAC8" width="186" height="*" style="border-collapse: collapse" border="0">
<tr>
<td height="100%" width="182"></td></tr></table>
</td>
<td width="573" valign="top" align="center" height="350">
<p><font face="Verdana" size="4">Elevinfo</font></p>
<?php
include("login_security.php");
include("dbconn.php");
session_start();
//opdatering af profilinformation, hvis man har ændret indstillingerne
if ($HTTP_POST_VARS['edit_submit']) {
if ($HTTP_POST_VARS['password'] && $HTTP_POST_VARS['password1'] && $HTTP_POST_VARS['password'] == $HTTP_POST_VARS['password1']){
$sql = sprintf("update users set password='%s', name='%s', adresse='%s', arbejde='%s', tlf='%s', email='%s' where username='%s'", $HTTP_POST_VARS['password'], $HTTP_POST_VARS['name'], $HTTP_POST_VARS['adresse'], $HTTP_POST_VARS['arbejde'], $HTTP_POST_VARS['tlf'], $HTTP_POST_VARS['email'], $HTTP_SESSION_VARS['user_username']) ;
$result = mysql_query($sql);
mysql_close();
header ("Location: login_profiloverview.php");
}
else
header ("Location: login_editprofil.php?message=Fejl ved opdatering");
}
$result = mysql_query(sprintf("SELECT * FROM users where id='%s'", $HTTP_SESSION_VARS['user_id']));
while ($row = mysql_fetch_array($result)) {
?>
<div align="center">
<br>
<table class="border" style="width:500px">
<tr><td>
<b> <?php if($message) echo "<font style=\"color:red\">" . $message . "</font><br><br>" ?></b>
<form action="login_editprofil.php" method="post" name="form">
<table>
<tr><td>Elevnr.:</td><td><input type="text" name="username" class="editprofil" class="editprofil" readonly value="<?php echo $row['username'];?>"></td></tr>
<tr><td>Navn:</td><td><input type="text" name="name" class="editprofil" value="<?php echo $row['name'];?>"></td></tr>
<tr><td>Adresse:</td><td><input type="text" name="adresse" class="editprofil" value="<?php echo $row['adresse'];?>"></td></tr>
<tr><td>Beskæftigelse:</td><td><input type="text" name="arbejde" class="editprofil" value="<?php echo $row['arbejde'];?>"></td></tr>
<tr><td>Telefon nr.:</td><td><input type="text" name="tlf" class="editprofil" value="<?php echo $row['tlf'];?>"></td></tr>
<tr><td>E-mail:</td><td><input type="text" name="email" class="editprofil" value="<?php echo $row['email'];?>"></td></tr>
<tr><td>Password:</td><td><input type="password" name="password" class="editprofil"> *</td></tr>
<tr><td>Gentag:</td><td><input type="password" name="password1" class="editprofil"> *</td></tr>
<tr><td></td><td><input type="submit" name="edit_submit" value="Opdater" class="editprofil2" style="width:70px"></td></tr>
</table>
</form>
* Skal udfyldes<br><br>
<font style="color:red">NB! Alle informationer der indtastes udover password, vil blive synlige for øvrige personer</font>
</td></tr>
</table>
</div>
<?php
// exit, da oplysningerne kun skal hentes én gang
mysql_close();
exit;
}
?>
</td>
</tr>
</table>
</div>
</body>
</html>
_________________________________
login_security.php ser således ud:
<?php
session_start();
if ($HTTP_SESSION_VARS['proceed'] != true){
header("Location: login_main.php");
exit;
}
?>
_____________________________________
Man logger ind fra en anden side, oplysninger der rettes i bliver gemt, men som sagt kommer man ik ind på profil_overview.php, men derimod bare til login_editprofil.php, men der er der ik noget ud over teksten Elevinfo i starten, formen forsvinder