- data from dropdown box in form being sent to db as 'Array'
- <?php
- include ('../connect.php');
- if(isset($_POST['submit']))
- {
- $qty = $_POST['qty'];
- $mob_name = $_POST['mob_name'];
- $item_img = $_POST['item_img'];
- $item_name = $_POST['item_name'];
- //save the name of image in table
- $query = mysql_query("INSERT INTO tbl_drop VALUES('','$mob_name','$item_img','$item_name','$qty')") or die(mysql_error());
- }
- $query_Recordset1 = "SELECT mob_name FROM tbl_img ORDER BY mob_name ASC";
- $Recordset1 = mysql_query($query_Recordset1) or die(mysql_error());
- $row_Recordset1 = mysql_fetch_assoc($Recordset1);
- $totalRows_Recordset1 = mysql_num_rows($Recordset1);
- $query_Recordset2 = "SELECT item_name FROM tbl_itm ORDER BY item_name ASC";
- $Recordset2 = mysql_query($query_Recordset2) or die(mysql_error());
- $row_Recordset2 = mysql_fetch_assoc($Recordset2);
- $totalRows_Recordset2 = mysql_num_rows($Recordset2);
- $query_Recordset3 = "SELECT item_img FROM tbl_itm ORDER BY item_name ASC";
- $Recordset3 = mysql_query($query_Recordset3) or die(mysql_error());
- $row_Recordset3 = mysql_fetch_assoc($Recordset3);
- $totalRows_Recordset3 = mysql_num_rows($Recordset3);
- ?>
- <html>
- <head>
- <title></title>
- </head>
- <body>
- <form id="form1" name="form1" enctype="multipart/form-data" method="post" action="new_drop.php">
- <label>Mob Name:
- <select name="mob_name" id="mob_name">
- <?php
- do {
- ?>
- <option value="<?php echo $row_Recordset1?>"><?php echo $row_Recordset1['mob_name']?></option>
- <?php
- } while ($row_Recordset1 = mysql_fetch_assoc($Recordset1));
- $rows = mysql_num_rows($Recordset1);
- if($rows > 0) {
- mysql_data_seek($Recordset1, 0);
- $row_Recordset1 = mysql_fetch_assoc($Recordset1);
- }
- ?>
- </select>
- </label>
- <p>
- <label>Item Name:
- <select name="item_name" id="item_name">
- <?php
- do {
- ?>
- <option value="<?php echo $row_Recordset2?>"><?php echo $row_Recordset2['item_name']?></option>
- <?php
- } while ($row_Recordset2 = mysql_fetch_assoc($Recordset2));
- $rows = mysql_num_rows($Recordset2);
- if($rows > 0) {
- mysql_data_seek($Recordset2, 0);
- $row_Recordset2 = mysql_fetch_assoc($Recordset2);
- }
- ?>
- </select>
- </label>
- <p>
- <label>Item Image:
- <select name="item_img" id="item_img">
- <?php
- do {
- ?>
- <option value="<?php echo $row_Recordset3?>"><?php echo $row_Recordset3['item_img']?></option>
- <?php
- } while ($row_Recordset3 = mysql_fetch_assoc($Recordset3));
- $rows = mysql_num_rows($Recordset3);
- if($rows > 0) {
- mysql_data_seek($Recordset3, 0);
- $row_Recordset3 = mysql_fetch_assoc($Recordset3);
- }
- ?>
- </select>
- </label>
- <p>
- <label>Quantity:
- <input type='text' name='qty' />
- </label>
- <p>
- <label>
- <input type="submit" name="submit" id="submit" value="Submit" />
- </label>
- </p>
- </form>
- </body>
- </html>
- <?php
- mysql_free_result($Recordset1);
- mysql_free_result($Recordset2);
- mysql_free_result($Recordset3);
- ?>
- <option value="<?php echo $row_Recordset3?>"><?php echo $row_Recordset3['item_img']?></option>
- <option value="<?php echo $row_Recordset3['item_img']?>"><?php echo $row_Recordset3['item_img']?></option>