this is the html:

<!--this is my best site so dont look up here and steal!-->
<!DOCTYPE html>
 <html>
  <head>
   <meta http-equiv="Content-Type" content="text/html; charset=windows 1252"> 
   </head>
   <body>
 <table bgcolor="white" align="center" border="1" width="400" cellpadding="10" cellspacing="0">
 <tr>
 <td>
   <h1 align="center">Forms</h1>
<hr>
<form action="php.php" method="POST" name="form1">
<p><strong>Name</strong><br>
<input type="text" name="name" width="20">
</p>

<p><strong>Password</strong><br>
<input type="Password" name="Password" width="20">
</p>

<p><strong>Email</strong><br>
<input type="text" name="Email" width="20">
</p><br>
<hr>
<p><strong>Which OS You Using?</strong><br>
<input type="radio" name="OS" value="windows">Windows<br>
<input type="radio" name="OS" value="mac os">Mac OS<br>
<input type="radio" name="OS" value="linux">Linux<br>
<input type="radio" name="OS" value="other">Other<br>
</p>
<hr>
<p><strong>What Do You Do Often In The Computer</strong><br>
<input type="checkbox" name="Play" value="1">Play<br>
<input type="checkbox" name="Work" value="1">Work<br>
<input type="checkbox" name="Movies" value="1">Watch Movies<br>
<input type="checkbox" name="Other2" value="1">Other<br>
</p>
<hr>
<p><strong>Choose Region</strong><br>
<select name="Region" size="1">
<Option>Africa</Option>
<Option>Asia</Option>
<Option>Central America</Option>
<Option>Eastern Europe</Option>
<Option>European Union</Option>
<Option>Middle East</Option>
<Option>North America</Option>
<Option>Oceania</Option>
<Option>South America</Option>
<Option>The Caribbean</Option>
</select>
</p>

<p><strong>Tell Us Somthing About Us!</strong><br>
<textarea name="commant" cols="40" rows="4">
</textarea>
</p>

<p>
<input type="submit" name="button" value="send">
</p>

</form>   
 </tr>  
</td>
</table>   
    </body>
    </html>

THIS IS THE PHP:

<?php

if (isset($play)) {$play="yes";} else {$play="NO";}
if (isset($work)) {$work="yes";} else {$work="NO";}
if (isset($movies)) {$movies="yes";} else {$movies="NO";}
if (isset($other)) {$other="yes";} else {$other="NO";}
mail("Erik@Gelfat.com","Register HTML","Someone registered to your site: \n his name: $name his pass: $password \n his email: $emial \n his os: $OS \n What often he does in the computer play $play work $work watch movies $movies other $other \n his region $region \n his commant: $commant","content-type:text/plain; charset = windows-1252\r\n");

?>

and when i fill up evrything i get this:
his name: his pass:
his email:
his os:
What often he does in the computer play NO work NO watch movies NO other NO
his region
his commant:

Edited 3 Months Ago by Reverend Jim: Moved to programming forum

Hi,

it seems you're trying to access the variables, sent by the POST request, through the register_globals directive, which initialize new variables basing on what is sent to the script, which was a very dangerous practice and has been removed from PHP 5.4. If you're using a previous version, leave it off and use $_POST or better use filter_input().

See:

Edited 3 Months Ago by cereal

Did you fix it?

In practice, you have to change these lines:

if (isset($play)) {$play="yes";} else {$play="NO";}
if (isset($work)) {$work="yes";} else {$work="NO";}
if (isset($movies)) {$movies="yes";} else {$movies="NO";}
if (isset($other)) {$other="yes";} else {$other="NO";}

to something like this:

$play = filter_input(INPUT_POST, 'Play', FILTER_VALIDATE_BOOLEAN);
if(TRUE === is_null($play) || FALSE === $play) $play = 'NO';

Repeat the same for the other variables.

By submitting a form, if a checkbox is not checked then it is not sent with the request. It means that you have to verify two things:

  • if it was sent
  • if the submitted value is valid

Whenever the FILTER_VALIDATE_BOOLEAN filter receives one of these values:

  • 1
  • true
  • on
  • yes

it will return it, otherwise: if the checkbox was not checked it will return NULL; if the value was not conform, it will return FALSE.

So, instead of using:

<input type="checkbox" name="Play" value="1">

Write:

<input type="checkbox" name="Play" value="Yes">

And if the filter validates successfully, then the value of $play will be Yes automatically, otherwise it will fall to the value assigned by the the IF statement:

if(TRUE === is_null($play) || FALSE === $play) $play = 'NO';

Consider also that the input names are case sensitive, so it must reflect what is defined in the input name attribute. I.e. validate for Play rather than play.

If you still not resolve, provide your last codes and the error information.

And you can use attribute "required" for all required fields in a form such as:

<input type="email" name="email" width="20" required="required" />

HTML5 input type "email" is supported. if you use this type then client web browser check input email address before data form send to server. On the server side check email address with "filter_input()".

$email = filter_input(INPUT_POST, 'email', FILTER_VALIDATE_EMAIL);