I'm wondering if some kind soul could give me some help with my PHP.
I'm trying to submit an entry to a new row in a database table. The data in the text areas seems to get entered no problem. However, the values from the dropdown menu don't seem to be submitted. The dropdown menu is being populated from another table in the database. I'm using the code below:
 |  |  |
 | Code: <form action="insertJob.php" method="POST"> <?php //Script to retrieve clients and populate drop down $mysqli = mysqli_connect("localhost", "root", "root", "Job_list"); $sql = "SELECT Client FROM Clients"; $res = mysqli_query($mysqli, $sql); ?> <select name="client"> <?php while ($line = mysqli_fetch_array ($res, MYSQLI_ASSOC)) { ?> <option value="<?php $line[Client];?>"> <?php echo $line[Client];?></option> <?php } ?> </select> <textarea name="description" rows="1" cols="20">Job description</textarea> <?php //Script to retrieve statuses and populate drop down $mysqli = mysqli_connect("localhost", "root", "root", "Job_list"); $sql = "SELECT Status FROM Statuses"; $res = mysqli_query($mysqli, $sql); ?> <select name="status"> <?php while ($line = mysqli_fetch_array ($res, MYSQLI_ASSOC)) { ?> <option value="<?php $line[Status];?>"> <?php echo $line[Status];?></option> <?php } ?> </select> <textarea name="notes" rows="2" cols="20">Notes</textarea> <input type="submit" value="Submit"> </form>
|  |
 |  |  |
I'm wondering if the option value is being posted as the php code. However, I thought that the php should be invisible to the browser and would submit the data that it had displayed.
I have sort of cobbled together the code with a mixture of copy and paste and a quarter an idea of what to do.