Witam, jak dane z whilie wyświetlić w $_POST danego ‘charname’ z whilie
poniżej mam kod php ale nie dokońca dobrze wyświetla on level danego charname bo wyświetla innego charname level a nie tego co wybralem
<?php
if(isset($_SESSION['zalogowany'])) {
//nr1
?>
<?php
$id=$_SESSION['username'];
$query ="SELECT * FROM accounts,characters WHERE accounts.accountID=characters.ownerID AND username='$id'";
$result = mysql_query($query) or die(mysql_error());
// Print out the contents of each row into a table
echo "<FORM method='POST' action='char.php'>";
echo "Wybierz Postać:<br><select size=1 name=show>";
while($row = mysql_fetch_array($result)){
$charname[1] = $row['charname'];
$level=$row['level'];
echo '<option>'.$charname[1].'</option>';
echo "</selct>";
}
echo "<input type='submit' value='Pokaż'></form>";
if( $_POST["show"])
{
echo "Wybrano: ".$row['level'];
}
mysql_free_result($result);
?>
<?
} else
{
echo "<p class='error'>Strona dosępna po zalogowaniu.</p>" ;
};
?>