I would like all additional input of benodigheden and ingrediënten are also sent. However, I do not know how you could pick up the cost of additional input. I hope somebody can help me.
This is my code
<div id="versturen">
<?php
if(isset ($_POST['Verzenden']))
{
$name = $_POST['Naam'];
$Email = $_POST['Email'];
$opmerking = $_POST ['Opmerking'];
$seizoen = $_POST ['Seizoen'];
/*-------------------------------------------------------------------------------------*/
/*---benodigheden---begin---*/
$benodigheden1 = $_POST ['benodigheden1'];
/*---benodigheden---eind---*/
/*---ingrediënten---begin---*/
$ingrediënten1 = $_POST ['ingrediënten1'];
/*---ingrediënten---eind---*/
$stappenplan = $_POST['stappenplan'];
/*-------------------------------------------------------------------------------------*/
$opmerking = $_POST ['Opmerking'];
/*-------------------------------------------------------------------------------------*/
$subject = 'GERECHT INDIENEN' . $seizoen . '' ;
$to = 'wross@live.nl, wvanhees35@hotmail.com';
$gerecht = 'BENODIGHEDEN <br />' . $benodigheden1 . '<br /> NGREDIËNTEN <br />' . $ingrediënten1 . '<br /> STAPPENPLAN <br />'. $stappenplan . '<br />';
$message = ''.$gerecht . $opmerking . ' Dit gerecht is ingestuurd door ' . $name . ' en is ingediend via ' .$Email;
mail($to, $subject, $message, "From:" . $Email)
?>
<div id="testing"><br /><h2>Uw mail is verzonden</h2></div>
<?php
header("Refresh: 3; URL=../index.php");
}
else{
?>
<form action="" method="post">
<legend>Neem contact op</legend>
<table>
<tr>
<td>
<label for="Naam">Naam: </label>
</td>
<td>
<input type="text" id="Naam" name="Naam" placeholder="Naam" required="required" />
</td>
</tr>
<tr>
<td>
<label for="Email">Email :</label>
</td>
<td>
<input type="email" id="Email"name="Email" placeholder="Email" required="required" />
</td>
</tr>
<tr>
<td>
<label for="Seizoen">Seizoen: </label>
</td>
<td>
<select name="Seizoen" id="Seizoen" required>
<option value="">Kies hier je seizoen</option>
<option value="Lente">Lente</option>
<option value="Zomer">Zomer</option>
<option value="Herfst">Herfst</option>
<option value="Winter">Winter</option>
</select>
</td>
</tr>
<tr>
<td colspan="2">
<hr />
</td>
</tr>
<tr>
<td>
<label for="benodigheden1">Benodigheden:</label>
</td>
<td>
<input type="text" id="benodigheden1"name="benodigheden1" placeholder="Benodigheden" required="required" />
</td>
</tr>
<tr>
<td>
<label for="ingrediënten1">Ingrediënten:</label>
</td>
<td>
<input type="text" id="ingrediënten1"name="ingrediënten1" placeholder="Ingrediënten" required="required" />
</td>
</tr>
<tr>
<td>
<label for="stappenplan">Stappenplanm:</label>
</td>
<td>
<textarea name="stappenplan" id="stappenplan" cols="40" rows="5" placeholder="Stappenplan" required="required" /></textarea>
</td>
</tr>
<tr>
<td colspan="2">
<hr />
</td>
</tr>
<tr>
<td>
<label for="Opmerking">Opmerking:</label>
</td>
<td>
<textarea name="Opmerking" id="Opmerking" cols="40" rows="5" placeholder="Opmerking" required="required" /></textarea>
</td>
</tr>
<tr>
<td>
</td>
<td>
<div class="submit"><input type="submit" value="Verzenden" name="Verzenden" /></div>
</td>
</tr>
</table>
</form>
<?php
};
?>
</div>
Here is a link to JSFiddle . He does not address here all my code (just as here).
Name the original and newly spawned input fields ingredienten[] and benodigheden[]
this will make them come in as a array in php.
foreach($_POST['benodigheden'] as $value){
echo $value .'<br />';
}
offcourse you need to change it to something usefull
I made a example see jsfiddle here place the above php somewhere and see wat happens if you submit
changed the html form input fields
<input type="text" id="benodigheden1"name="benodigheden[]" placeholder="Benodigheden" required="required" />
<input type="text" id="ingrediënten1"name="ingrediënten[]" placeholder="Ingrediënten" required="required" />
changed the javascript by adding this line " .attr('name',res[0]+'[]') "
// Add a line, and make it non-mandatory
$(this).clone()
.attr('id', newId).removeAttr('required')
.attr('name',res[0]+'[]')
.val('')
.insertAfter(this)
.before($('<br>'));
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.