<?php
		 						$posapp=$_POST['txtapplied'];
								$fname=$_POST['txtfname'];
								$mname=$_POST['txtmname'];
								$lname=$_POST['txtlname'];
								$month=$_POST['txtmonth'];
								$day=$_POST['txtday'];
								$year=$_POST['txtyear'];
								$age=$_POST['txtage'];
								$eadd=$_POST['txtemail'];
								$homenumber=$_POST['txthnum'];
								$cpnumber=$_POST['txtcpnumber'];
								$address=$_POST['txtaddress'];
								$religion=$_POST['txtreligion'];
								$birthplace=$_POST['txtbplace'];
								$height=$_POST['txtheight'];
								$weight=$_POST['txtweight'];
								$civilstatus=$_POST['txtcstatus'];
								$college=$_POST['txtcollege'];
								$course=$_POST['txtcourse'];
								$year=$_POST['txtyeargrad'];
								
							$db=mysql_connect('localhost','root','') or die ('Cannot connect to MYSQL!');
							@mysql_select_db('dbriomra') or die('Cannot connect to database');

		
							$query=mysql_query("Insert into onlineapplication values ('posapp', 'fname', 'mname', 'lname', 'month', 'day',
'year', 'age', 'eadd', 'homenumber', 'cpnumber', 'address', 'religion', 'birthplace', 'height', 'weight', 'civilstatus', 'college','course', 'year')");
							
							if($posapp!=NULL || $fname!=NULL || $mname!=NULL || $lname!=NULL || $month!=NULL || $day!=NULL || $year!=NULL || $age!=NULL || $eadd!=NULL || $homenumber!=NULL || $cpnumber!=NULL || $address!=NULL || $religion!=NULL || $birthplace!=NULL || $height!=NULL || $weight!=NULL || $civilstatus!=NULL || $college!=NULL || $course!=NULL || $year!=NULL)
							
					
								if(mysql_query($query))
								{
									echo "<br>" .mysql_affected_rows($db). "record added";
								}
								else
								{
									echo "<br> Problem Loading";
								}
					
							mysql_close($db);
				
					?>

the declarations of my textboxes, are not detected, i don't know why, PLEASE HELP. thank you!

Dani AI

Generated

The symptoms in the code posted by point to a few concrete, common mistakes rather than a mysterious PHP bug. was right to suggest inspecting the POST data — confirm the form is submitting and that each input has the exact name attribute you expect (method must be POST, action must target this script). If the POST array is empty, the problem is the form, not the insert.

Primary problems to fix (with reasons and practical fixes):

  • Variable collision and validation logic: the same variable name is used twice for different fields (your birth year and graduation year). Use distinct names (e.g., birthYear and gradYear). The validation uses OR so it passes as soon as one field is nonempty; use AND or check each required field with isset()/empty()/proper validators (email via a filter).

  • SQL and query misuse: the code is inserting literal strings like 'posapp' instead of the variable values, and you call the query function twice (you set $query to the result and then call the query function on that result). Always build an SQL string (or better, use prepared statements), call the query once, and check the result or exception.

  • Security and modern PHP: the old mysql_* extension is deprecated/removed. Migrate to mysqli or PDO and use prepared statements to avoid injection problems and to get clearer error messages (see mysqli prepared-statement quickstart).

Minimal safe pattern to follow (use prepared statements, list columns explicitly, bind values). For reference and examples see the PHP manual on prepared statements: mysqli prepared statements quickstart and note that mysql_connect is deprecated: mysql_connect.

Follow that checklist: confirm POST payload, fix variable names, use prepared INSERT with explicit columns, and enable/display (or log) database errors during development.

Recommended Answers

All 4 Replies

Member Avatar for Member #120589

You should read the forum guidelines. Use code tags!

You've posted this in 3 separate threads. You're having a laugh mate.

try

var_dump($_POST);

if they don't show up you got a problem with your form page

You should read the forum guidelines. Use code tags!

You've posted this in 3 separate threads. You're having a laugh mate.

im sorry. i'm confused

try

var_dump($_POST);

if they don't show up you got a problem with your form page

it doesn't show any error, by the way, thanks

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.