emailing form information
ok i no the basics of php as i have been looking at in for about a month now but i cant seem to work this out i have a form like
<form name="Voting2006" method="POST" action="toscriptpage" title="Voting 2006">
//used to be able to find the other name fields.
<input type="hidden" name="required" value="groupButton, food" />
//what ever name fields the user wonts
<input type="text" name="food" Value="it works" />
<input type="text" name="groupButton" Value="barrattTyGlas" />
<input type="submit" name="Submit" value="Register my vote" />
</form>
which posts to this code
$required = $_POST['required'];
$require = split(",",$required);
foreach($require as $values){
$value = preg_replace('/[\\ \-_\/]/', '', $values);
echo $_POST[$value];}
which works and displays the two users inputs on the screen but what i wont to do is sent this in an email so i tryed
$required = $_POST['required'];
$require = split(",",$required);
foreach($require as $values){
$value = preg_replace('/[\\ \-_\/]/', '', $values);
$fields = "$_POST[$value]<br />";}
mail(all information you need filed in correct);
then for the email body i added the $fields Where i wonted it but it only sends the last input input value in this case being "it works" im geussing im going the wrong way about this.
so after seaching around i havent really found anything which will allow this have play with arrays a little but have had no luck so if someone could point me in the right direction that would be great.As im not 100% shore on another way i might be able to do this.
hope this is clear thanks in advance
mark
|