Quantcast
Channel: Active questions tagged html - Stack Overflow
Viewing all articles
Browse latest Browse all 72473

modal form with dropdown to mysql not submitting

$
0
0

Can't find posts/answers that work for me. Everything in my page and modal works fine. I'm able fill the form out and select items in my dropdown the way i want. Issue is when i submit the form the page returns error 500 and says it's not working. Any help would be greatly appreciated, new to coding.

Following is one of the html dropdown items (i have three in the form + 2 input fields. As input fields they all worked fine and the form worked perfectly until i converted three to dropdowns):

`<tr>
 <td><label class="col-form-label col-form-label-sm">Department</label></td>
 <td width="10"></td>
 <td>
   <select type="text" name="proj_dept" class="form-control form-control-sm" id="validationDefault01" required>
      <option value="" selected disabled>Select</option>
         <?php  $result3 = $dbConn->query("SELECT * FROM a0_lists WHERE list_group='Departments' ORDER BY list_code ASC");
         while($row3 = $result3->fetch(PDO::FETCH_ASSOC)) {         
         echo "<option value=".$row3['list_code'].">".$row3['list_code']."</option>";
         } ?>
   </select>
 </td>
</tr>`

Action php for form (again, this worked before I converted a couple fields to dropdowns:

`<?php require_once('../db.php');

$proj_name= $_POST['proj_name'];
$proj_desc= $_POST['proj_desc'];
$proj_priority= $_POST['proj_priority'];
$proj_status= $_POST['proj_status'];
$proj_dept= $_POST['proj_dept'];

$conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
$sql = "INSERT INTO a0_lists (proj_name, proj_desc, proj_priority, proj_status, proj_dept)
VALUES ('$proj_name', '$proj_desc', '$proj_priority', '$proj_status', '$proj_dept')";

$conn->exec($sql);
echo "<script>alert('Successfully Added!'); window.location='../proj/proj.php'</script>"; ?>`

Viewing all articles
Browse latest Browse all 72473

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>