Hello.
First of all, i want to apologize for my question, since the code im about to post is way outdated.
I am hosting this script on a server which is running a very old version of php.
The website is used by me and 2 other friends, and we are the only ones able to connect to it, due to .htaccess only showing the page to recognized ip adresses… So there is no need to protect against sql injection or anything.
Now that thats out of the way, here is the problem i am facing:
i have a php script, which is showing a dropdown menu, with values gathered from a mysql table called chat_clothes.
I then have a submit button, that is supposed to post whatever you have chosen in the dropdown menu, to another table called chat_brugere
But when i click the submit button, it posts “Resource id #7”, instead of the selected value.
Here is my code:
<?php
@session_start();
header('Content-Type: text/html; charset=ISO-8859-1');
include('includes/config.php');
?>
<link rel="stylesheet" type="text/css" href="css/chat.css" />
<div id="sidebar_header">Garderobe</div>
<div id="sidebar_content">
<p style="display: inline;">Skid i havet.</p><br /><br />
<select name="sko">
<?php
if(isset($_SESSION['logget_ind']) && $_SESSION['logget_ind'] == true) {
$getSko = mysql_query("SELECT `navn` FROM `chat_clothes` WHERE `ejer` = '".$_SESSION['brugernavn']."' AND `type` = 'sko'");
while ($showSko = mysql_fetch_array($getSko)) {
echo '<option id="sko" name="sko" style="width: 300px;">'.$showSko['navn'].'</option><br />'
;
}
}
?>
</div>
</select>
<?php
if (isset($_POST['sko'])) {
mysql_query("UPDATE chat_brugere SET shoes='".$getSko."' WHERE id='".$_SESSION['id']."'");
echo 'sko er opdateret!';
} else {
echo '';
}
echo '
<form action="nygad.php" method="POST">
<div>
<table>
<tr>
<td><center><input type="submit" name="sko" value="Opdater!" /></center></td>
</tr>
</table>
</div>
</form>
';
?>