Hello there, anyone can help me with my problem?

my problem is, i want to display a "please complete all the fields" when the user inputs incomplete data in the textboxes and i want to display it in the same form.

im new in php.

These are my codes

		$posapp = $_POST['txtapplied']; 
		$fname = $_POST['txtfname']; 
		$mname = $_POST['txtmname']; 
		$lname = $_POST['txtlname']; 
		$db=mysql_connect('localhost','root','') or die ('Cannot connect to MYSQL!');
		@mysql_select_db('dbriomra') or die('Cannot connect to database');

		$query="INSERT INTO onlineapplication (positionapplied, firstname, middlename, lastname, month, day, year, age, emailaddress, homenumber, cellphone, address, religion, birthplace, height, weight, civilstatus, college, course, yeargrad) VALUES ('$posapp', '$fname', '$mname', '$lname', '$month', '$day', '$year', '$age', '$eadd', '$homenumber', '$cpnumber', '$address', '$religion', '$birthplace', '$height', '$weight', '$civilstatus', '$college', '$course', '$yeargrad')";

  //$result = mysql_query($query); 
         header('Location: oapp_finished.php');
         echo "<br> Problem Loading";

Post your validation code...

Karthnik_pranas , i want to display a "Please complete all the required fields". but i don't know where i need to put it. i'm new in php, can you help me?

And make sure you secure those $_POST[] :S

for instance.. $posapp = mysql_real_escape_string($_POST);
I could easily mess up your database with a simple injection. Dont ever trust the classic "they dont know how this code look" thought.