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:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 | <?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> '; ?> |
0 comments:
Post a Comment
Thanks