Jump to content

Insert dynamic droplist


myrok24

Recommended Posts

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

 

<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>

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.