Not getting my data inserted into mysql database using html

There isn’t any mistake in my code but still am not getting my data inserted into mysql database using html … please guide me if there is any mistake within it

<form action="students.php" method="post ">
<table width="600" border="10" align="center" >
<td bgcolor="blue" align="center" colspan="5" ><h2>STUDENT'S REGISTRATION</h2></td>
<td align="right" >STUDENT NAME:</td>
<td  ><input type="text" name="student_name" ></td>

<td align="right" >SCHOOL NAME:</td>
<td><input type="text" name="school_name"></td>

<td align="right" >ROLL NO:</td>
<td><input type="text" name="roll_number"></td>

<td align="right" >STATUS:</td>
<td><input type="text" name="status"></td>

<td align="right" colspan="5" ><input type="submit" name="submit" value="SUBMIT"</td>


<table width="600" border="10" align="center">
<th>Serial No.</th>
<th>SCHOOL NAME</th>
<th>ROLL NO</th>

$query1="select * from students";

<tr align="center" >
			<td><?php echo $id; ?></td>
		    <td><?php echo $s_name; ?></td>
			<td><?php echo $school; ?></td>
			<td><?php echo $roll; ?></td>
			<td><?php echo $result; ?></td>
			<td> Edit</td>
<?php } ?>
if (isset($_POST['submit']))
     $query ="insert into students(NAME,SCHOOL_NAME,ROLL_NUMBER,STATUS) values ('$name','$school','$roll','$result')";



There are mistakes, as you know/don’t know. :slight_smile:
The insert query is never executed, it just gets put in a variable.
But, that is not all that is wrong, there is more, but it’s late here and I’m not at best right now to deal with it, so just the main point.

these calls no longer exist - they were removed from PHP last year - the mySQLI and PDO interfaces were introduced in 2004 to replace it.

Also there is no need to connect to the database multiple times - once per script is sufficient unless you are connecting to more than one server.

I am sure others will come along to tell you about more of the errors.

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.