Help with Verification PHP Form!?!

Hello,
I’m trying to add basic verification to my form. All I want is if the field is empty to say Please go back and enter in all the fields. Here is basically what I’m working with there are about 20 different radio buttons 10 per selection, text fields, and a message box.

Here is the HTML:
[php]




Contact Information

  <center><img src="line.jpg" /></center>

  </td>
First Name:

Last Name:

Email Address:

Verify Email:


Web Development


</table>

<br /><center><img src="line.jpg" /></center>

ASP.NET

Skill Level:

1 2 3 4 5 6 7 8 9 10

Ajax

Skill Level:

1 2 3 4 5 6 7 8 9 10
A value is required.



[/php]

Here is the PHP:
[php]<?php

//print “this is the last record”;
// EDIT THE 2 LINES BELOW AS REQUIRED
$email_to = "[email protected]";
$email_subject = “Application - Global Web Lab”;

     $email_message .= "First Name Entered: ".$_POST["fname"]."\n";
     
	 $email_message .= "Last Name Entered: ".$_POST["lname"]."\n";
     
	 $email_message .= "Email Entered: ".$_POST["email"]."\n";
     
	 $email_message .= "Email VERIFICATION: ".$_POST["emailv"]."\n";

$email_message .= "ASP RATED: ".$_POST["ASPNET"]."\n";

$email_message .= "Ajax Rated: ".$_POST["Ajax"]."\n";

$email_message .= "C Rated: ".$_POST["C"]."\n";

$email_message .= "CSS Rated: ".$_POST["CSS"]."\n";

$email_message .= "CSS3 Rated: ".$_POST["CSS3"]."\n";

$email_message .= "HTML Rated: ".$_POST["HTML"]."\n";

$email_message .= "HTML5: ".$_POST["HTML5"]."\n";

$email_message .= "Java Rated: ".$_POST["Java"]."\n";

$email_message .= "Javascript Rated: ".$_POST["Javascript"]."\n";

$email_message .= "Jquery Rated: ".$_POST["Jquery"]."\n";

$email_message .= "Perl Rated: ".$_POST["Perl"]."\n";

$email_message .= "PHP Rated: ".$_POST["PHP"]."\n";

$email_message .= "Python Rated: ".$_POST["Python"]."\n";

$email_message .= "Ruby Rated: ".$_POST["Ruby"]."\n";

$email_message .= "VBScript Rated: ".$_POST["VBScript"]."\n";

$email_message .= "XML Rated: ".$_POST["XML"]."\n";

$email_message .= "Cinima4D Rated: ".$_POST["Cinima4D"]."\n";

$email_message .= "Maya Rated: ".$_POST["Maya"]."\n";

$email_message .= "Matrix Rated: ".$_POST["Matrix"]."\n";

$email_message .= "General Rated: ".$_POST["data"]."\n";

$email_message .= "Portfolio Message: ".$_POST["previous"]."\n";

// $email_message .= “MESSAGE: “.$_POST[“message”].”\n”;
$ip=$_SERVER[‘REMOTE_ADDR’];

 $email_message .= "IP ADDRESS: ". $ip."\n";

$ip=$_ENV[‘REMOTE_ADDR’];

// create email headers
$headers = 'From: '.$_POST[“email”]."\r\n".
'Reply-To: '.$_POST[“email”]."\r\n" .
‘X-Mailer: PHP/’ . phpversion();
@mail($email_to, $email_subject, $email_message, $headers);
//print $_GET[“email”];
//print “it worked”;
print "
h3{
padding-bottom:0px;
padding-left:15px;
color:#333;
}
h2{
padding-bottom:0px;
padding-left:15px;
color:#333;
}
h22{
padding-bottom:0px;
padding-left:15px;
color:#333;
text-align:center;
font-size:26px;
}
p{
padding-bottom:0px;
padding-left:20px;
color:#555;
}
p1{
padding-bottom:0px;
padding-left:20px;
color:#555;
}
p2{
color:#555;
}
background{
background-image:url(img/b.jpg);
}
body{
background-color: #CCC;
background-image:url(img/b.jpg);
}
.container{
box-shadow: 1px 1px 20px #888888;
}
.submit{
padding-left:20px;
}
.input{
padding-left:20px;
}
.footer{
background-color:#fff;
color:#555;
width:610px;
}

Global Web Lab


Thank you!

You have succesfully submitted your application.
Please allow up to 48 hours for a representative to review your appliction and respond.




























Copyright © 2014 Global Web Lab, LLC - Copyright 2014. - All rights reserved.
  </td></table>

";
die();

?>[/php]

The simplest thing you can do is add required to the inputs. HTML5 will display a default message to the user and not let them continue. Other options are to use Javascript or Jquery for validation

<input type="radio" name="ASPNET" value="1" id="ASPNET_0" required />

I can just add required to the code?
I added
[php][/php]

and
[php][/php]

Without any luck but I dont think I used that right.

GOT IT!
[php][/php]
I didnt know you needed the required=""

The example I gave you is html 5 valid. The way you did it is for XHTML (A version of Html4).

In XHTML, attribute minimization is forbidden, and the required attribute must be defined as [php] [/php]

Html5
[php][/php]

Since it didnt work the html5 way, you most likely have your document type set like so:
[php] [/php]

This is the Html5 document type
[php] [/php]

Html5 page example:
[php]

Html5 Page [/php]
Sponsor our Newsletter | Privacy Policy | Terms of Service