myrok24 Posted February 3, 2009 Share Posted February 3, 2009 Im trying to write (insert) data from a dynamic droplist to the database, but it's not giving any result. Droplist filling: <?php $query = "SELECT id, category, label FROM upload GROUP BY category"; $result = mysql_query($query) or die('Error : ' . mysql_error()); echo "<select name='category'id='category'>"; while($row=mysql_fetch_array($result)){ echo "<option value=$row[category]>$row[category]</option>"; } echo "</select>"; ?> That's working well... Later on i define the variable: <? $category = $_POST['category']; ?> And the processing: <? $query = "INSERT INTO upload (name, size, type, path, label, category) ". "VALUES ('$fileName', '$fileSize', '$fileType', '$filePath', '$label','$category')"; ?> What am i doing wrong? thnx! Link to comment https://forums.phpfreaks.com/topic/143665-insert-dynamic-droplist/ Share on other sites More sharing options...
Snart Posted February 3, 2009 Share Posted February 3, 2009 Can you post the HTML source code from your browser? There might be characters in the option values interfering with the attributes and tags. Link to comment https://forums.phpfreaks.com/topic/143665-insert-dynamic-droplist/#findComment-753789 Share on other sites More sharing options...
myrok24 Posted February 3, 2009 Author Share Posted February 3, 2009 <html> <head> <title>Upload File To MySQL Database</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <link href="../xxxx.css" rel="stylesheet" type="text/css"> </head> <body> <select name='category'id='category'><option value=></option><option value=Boeken>Boeken</option><option value=Campagne>Campagne</option><option value=Internet>Internet</option><option value=Lespaketten>Lespaketten</option><option value=Spellen>Spellen</option></select> <form action="" method="post" enctype="multipart/form-data" name="uploadform"> <table width="400" border="0" align="center" cellpadding="8" cellspacing="0" bordercolor="#FFFFFF" bgcolor="#99CC00"> <tr> <td class="info">Opdracht titel:</td> <td><input name="label" type="text" class="box" id="label"></td> </tr> <td class="info">Afbeelding uploaden:</td> <td><input name="userfile" type="File" class="box" id="userfile" size="15"></td> </tr> <tr> <td class="info"> </td> <td><input name="upload" type="Submit" class="dynamic_button" id="upload" value="Uploaden"> <input name="btnBack" type="button" class="dynamic_button" id="btnBack" onClick="window.location.href='cms-admin.php';" value="Overzicht"></td> </tr> </table> </form> </body> </html> Link to comment https://forums.phpfreaks.com/topic/143665-insert-dynamic-droplist/#findComment-753808 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.