det virker nu
[code lang="min cheak boks til opret "]$id = mysql_real_escape_string($_POST['id']);
$name = mysql_real_escape_string($_POST['name']);
$username = mysql_real_escape_string($_POST['username']);
$role_id = mysql_real_escape_string($_POST['role_id']);
$password = mysql_real_escape_string($_POST['password']);
$test = mysql_query("SELECT * FROM tbl_udv WHERE username='$username'");
if(mysql_num_rows($test) == 0) {
$rand = rand(100000,900000);
$result = mysql_query("INSERT INTO tbl_udv (username,password,role_id,name) VALUES ('$username','$password','$role_id','$name')");
$result = mysql_query("UPDATE login SET name='$name', username='$username', password='$password', role='$role_id' WHERE id='$id'")or die (mysql_error());
header("Location:222.php");
}
?>[/code]
<form action="supernu.php" method="POST">
<div class="midt">
<?php
if($_SESSION['err']) {
echo "<b>".$_SESSION['err']."</b><br /><br/>";
unset($_SESSION['err']);
}
?>
<div class="label">supportkode:</div>
<input type="text" name="username" value="<?php echo $row['username']; ?>"/><br>
<br /><br />
<div class="label">password:</div>
<input type="text" name="password" value="<?php echo $row['password']; ?>"/> <br>
<br /><br />
<div class="label">Rettigheder:</div>
<select name="role_id">
<option value="admin" <?php if($row['name'] == 'administrator') {echo "selected";}?>>admin</option>
<option value="Superadmin"<?php if($row['name'] == 'super administrator') ?> >Superadmin</option>
</select>
<br /><br />
<input type="hidden" name="id" value="<?php echo $row['id']; ?>" />
<input class="knapper1234" type="submit" name="submit" value="" />
<br/>
<br/>
<br/>
</div>
</div>
</form>