I am very new to HTML and PHP. I am trying to create a drop down menu to insert a selection into my database. I have been trying things for hours to get this to work. I have a form a client needs to fill out for an evaluation and they can only select from jobs that exist in the database already.
The evaluation table has the JobNo, evalDate, raterName, rating, and comment (optional). The JobNo is found in the jobs table as jobNo (lowercase j in the jobs table, uppercase in evaluation)
Bonus points if you can get it to fill data from the database as the drop down box choices. I tried that for forever too.
Please tell me what I am missing or doing wrong?
<!DOCTYPE html>
<html>
<body>
<body style="background-color:#FAEBD7;">
<title>CTS Employment Agency | Evaluation</title> <!-- title for tab on website -->
<center><h1 style="background-color: #FAEBD7;">CTS Employment Agency</h1></center>
<center><p>123 Anywhere St.<br>Huntsville, AL 35649<br>P: (256)555-5555<br>Fax:(256)554-5554<br>E-mail: questions@ctsemployment.com</p></center>
<center><h3>Evaluation Form</h3></center>
<center><p>Please take a moment to fill out the evaluation form concerning the worker that was provided to you.<br>
Please leave a rating from 1(unsatisfactory) to 5(excellent) for the worker along with a comment box for additional information.
<br> If you have any questions, please feel free to send us an email or call us!</p></center>
<form action="php_formStore.php" method="$Post_"> <!-- beginning of form -->
<br>
<center>
Worker First Name: <input type="text" name="wFName">
Middle: <input type="text" name="wMinit">
Last: <input type="Text" name="wLName">
SSN <input type="text" name="snn" placeholder="000-00-0000">
<br><br>
Job No:
<select name="JobNo">
<option value="46">46</option>
<option value="47">48</option>
<option value="48">48</option>
</select>
//<input type="text" name="JobNo"> //this works fine, why doesn't the select box work?
Worker's Job Title: <input type="text" name="title">
Rating: <input type="text" name="rating" placeholder="Rate from 1-5">
<br><br>
Evaluator's Name: <input type "text" name="raterName">
Evaluation Date: <input type="date" name="evalDate">
<br><br>
<!-- comment box -->
<textarea name="comment" rows="8" cols="60">
(Optional)
Leave any additional comments here.
</textarea><br>
<input type="submit" value="Submit"> <!-- The submit buttom -->
<input type="reset">
</center>
</form>
</body>
<html>
and here is the PHP file
<?php
$servername = "localhost";
$username = "root";
$password = "";
$db="cts employment agency"; //Database Name
$con=mysqli_connect($servername, $username, $password, $db);
//check connection
if(mysqli_connect_errno())
{
echo "Failed to connect to MySQL: " . mysqli_connect_error();
}
$Job_No = $_GET['JobNo'];
$raterName = $_GET['raterName'];
$evalDate = $_GET['evalDate'];
$rating = $_GET['rating'];
$comment = $_GET['comment'];
echo "<br><br><br><br>";
echo "<center><h2>Thank you for taking the time to fill out this evaluation<br>";
echo "Your feedback helps us to provide you with the highest quality employees<br>";
echo "If you have any questions, please e-mail us at: questions@ctsemployment.com or call: (256)555-5555</h2></center>";
mysqli_query($con, "INSERT INTO evaluation (JobNo, evalDate, raterName, rating, comment)
VALUES ('$Job_No', '$evalDate', '$raterName', '$rating', '$comment')");
mysqli_close($con);
?>
[1]: https://i.stack.imgur.com/2mJGC.png