Can someone please check my PHP for an html form. Please, I beg you.

<! DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional / / IN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd" > ""
"< html xmlns ="http://www.w3.org/1999/xhtml">".
< head >
< meta http-equiv = "Content-Type" content = text/html"; charset = utf-8 "/ >"
<!-TemplateBeginEditable name = "doctitle"-->
<? PHP
-Put these settings-

Subject of the email sent to you.
$subject = "AARegistration";

Your email address. This is where the information on the form will be sent.
$emailadd is [email address removed for privacy];.

Where redirect after form is processed.
$url = ' http://www.mocatholic.org/confirmation.html';

Makes all the required fields. If the value of '1' no field cannot be empty. If the '0' value any or all fields can be empty.
$req = '0';

-Do not edit below this line-
$text = "comes from the shape: \n\n";
$space = ' ';
$line = '
';
foreach ($_POST as $key = > $value)
{
If ($req is '1')
{
If ($value == ")
{echo "$key is empty"; die ;}
}
$j = strlen ($key);
If ($j > = 20)
{echo "Of the form $key name cannot be longer than 20 characters"; die ;}}
$j = 20 - $j;
for ($i = 1; $i < = $j; $i ++)
{$space. = ' ' ;}}
$value = str_replace ('\n', "$line", $value);
$conc = "{$key}: $space {$value} $line";
$text = $conc;
$space = ' ';
}
mail ($emailadd, $subject, $text, ' from: '. $emailadd. ");
echo "< META HTTP-EQUIV = CONTENT refresh ="0; " URL ='. $url. " » >';
? >

< title > Send < /title > results
<! - TemplateEndEditable - >
<!-TemplateBeginEditable name = "head"->
<! - TemplateEndEditable - >
< / head >

< body >
< / body >
< / html >

There are a lot of problems with this form.

First of all, it does not use the POST method. That's why you get nothing. Another major problem is your choice of names/IDs. A name/ID of form must have no spaces or special characters.

The opening form tag should look like this:

It is an example of one of your boxes:


It should look like this:


You have several other boxes that are simply named "checkbox. Everyone should have a name of the person, and the value must contain the message you want to appear in the email. The name attribute is what identifies the form field or a checkbox. Without it, you have nothing or garbage.

Through the entire form giving explicit names for each element of form, stick to the principle of a single word for the name. The value can be as long as you want.

Tags: Dreamweaver

Similar Questions

Maybe you are looking for