It has been years since I was in web development but have dabbled in PHP in the past, so I guess you could say I am a newbie at PHP. I am trying to build a simple form for a job application using PHP I want the form to be filled out and then emailed upon submit.
I have researched this site as well as others and am unable to get this to work. I cannot get the job value to show up in email:
Here is my HTML code:
<label>Position: check all you are interested in </label><br>
<input type="checkbox" name="job[]" value="General Pickle Production">General Pickle Production
<input type="checkbox" name="job[]" value="Fryer">Fryer
<input type="checkbox" name="job[]" value="Sales">Sales
<input type="checkbox" name="job[]" value="Manager">Manager
<input type="checkbox" name="job[]" value="Overnights">Overnights<br>
Here is my PHP code:
$aJob = $_POST['job'];
if(empty($aJob))
{
echo("You didn't select any job position.");
}
else
{
$N = count($aJob);
echo("You selected $N job(s): ");
for($i=0; $i < $N; $i++)
{
echo($aJob[$i] . " ");
}
}
When I hit submit on the form the above will show each job selected on the form page but I guess I am not sure how to send this to my email upon the submit. Below is the code I have sending the variables to my email:
$content = $_POST['name'] . " " . $_POST['lastname'] . " \n";
$content .= $_POST['address'] . " \n";
$content .= "Position(s) applied for: " . $_POST['aJob'] . " \n";
Do I need to put my for loop in $content section somewhere to display the jobs? I guess I am not sure what that format would look like here?
I appreciate any help you could offer. Thank you. J
Aucun commentaire:
Enregistrer un commentaire