Frage zum auslesen

R3D-k1lla

Grünschnabel
hallo

ich will in einem dropdown menü die user von einer datenbank einlesen aber irgendwie funkioniert das nicht richtig, der macht für jeden user ein neues menü

PHP:
<html>
<head>
<title>-sTh.cr3w- Admin</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link rel="stylesheet" href="http://www.sthcrew.de/sth.css" type="text/css">
</head>
<body bgcolor="#FFFFFF" text="#000000" background="http://www.sthcrew.de/images/bg.jpg">
<div align="center">
  <p>Login: </p>
<?php
$mysql_host = "localhost";
$mysql_user = "root";
$mysql_pw 	= "";
$mysql_db 	= "sth";

connect_db();

$result = mysql_query("SELECT * FROM sth_admin ORDER BY user");
while($admin = mysql_fetch_array($result))
{ ?>

  <form action="admin/checkuser.php" method="post">
    <table width="16%" border="0">
      <tr>
        <td>Username:</td>
        <td> 
          <?php echo "<select name='user'>"; ?>
            <?php echo "<option value='$admin[user]'>$admin[user]</option>"; ?>
          <?php echo "</select>"; ?>
        </td>
      </tr>
      <tr>
        <td>Passwort:</td>
        <td>
          <input type="password" name="password" size="30">
        </td>
      </tr>
    </table>
    <br>
  <input type="submit" value="Absenden">
</form>

<?php } ?>
  
</div>
  </body>

</html>
 
Code:
<php>
$result = mysql_query("SELECT * FROM sth_admin ORDER BY user");

 ?>



  <form action="admin/checkuser.php" method="post">

    <table width="16%" border="0">

      <tr>

        <td>Username:</td>

        <td> 
          <?php echo "<select name='user'>"; 
while($admin = mysql_fetch_array($result))

{
?>

            <?php echo "<option value='$admin[user]'>$admin[user]</option>"; 
 }
?>

          <?php echo "</select>"; ?>

        </td>

      </tr>

</php>

mit andern worten die schleife ist falsch plaziert *g*
 
Zuletzt bearbeitet:

Neue Beiträge

Zurück