# Self Processing Form PHP

**URL:** <https://forum.kirupa.com/t/self-processing-form-php/313094>\
**Category:** programming\
**Created:** [August 19, 2010, 5:40pm UTC](https://forum.kirupa.com/t/self-processing-form-php/313094 "2010-08-19T17:40:15Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![berryD](https://avatars.discourse-cdn.com/v4/letter/b/22d042/32.png) [@berryD](https://forum.kirupa.com/u/berryD)\
**Post date:** [August 19, 2010, 5:40pm UTC](https://forum.kirupa.com/t/self-processing-form-php/313094/1 "2010-08-19T17:40:15Z")

</div>

Hey,

I need to make a form that takes info like name, address (basic info) then I will have 4 check boxes. When the user clicks the check box I want an email sent back to them with the information that they requested.

I have a html page that has the form that submits to a php page below. What would I add in to redirect based on the check boxes that the user checks? (still learning PHP) thanks!:

\<?php

$subject = ‘test’;  
$emailadd = ‘info@test.com’;  
$url = ‘thx.html’;  
$req = ‘1’;

$text = "Results from form:

“;  
$space = ’ ';  
$line = ’  
';  
foreach ($\_POST as $key =\> $value)  
{  
if ($req == ‘1’)  
{  
if ($value == ‘’)  
{echo “$key is empty”;die;}  
}  
$j = strlen($key);  
if ($j \>= 100)  
{echo “Name of form element $key cannot be longer than 100 characters”;die;}  
$j = 100 - $j;  
for ($i = 1; $i \<= $j; $i++)  
{$space .= ’ ‘;}  
$value = str\_replace(’  
', “$line”, $value);  
$conc = “{$key}:$space{$value}$line”;  
$text .= $conc;  
$space = ’ ‘;  
}  
mail($emailadd, $subject, $text, ‘From: ‘.$emailadd.’’);  
echo ‘\<META HTTP-EQUIV=Refresh CONTENT="0; URL=’.$url.’”\>’;  
?\>
