RIYAN MEHMOOD
This Is The Coding- But Database Not Selected & Record Also Not Inserted-

***********************************************************

<html>
<head>
<title>Student's Data</title>
</head>
<body>

<form action="students.php" method="POST">
<table width="500" border="5" align="center">

<tr>
<td align="center" colspan="5" bgcolor="silver">
<h1>Student's Registration</h1></td>
</tr>


<tr>
<td align="right">Student Name:</td>
<td><input type="text" name="name"></td>
</tr>

<tr>
<td align="right">School Name:</td>
<td><input type="text" name="school"></td>
</tr>

<tr>
<td align="right">Roll No:</td>
<td><input type="text" name="roll"></td>
</tr>

<tr>
<td align="right">Result:</td>
<td><input type="text" name="result"></td>
</tr>

<tr>
<td colspan="5" align="center">
<input type="submit" name="submit" value="Submit Now"></td>
</tr>

</table>
</form>
</body>
</html>

<?php
$server="localhost";
$user="root";
$pass="";

mysqli_connect($server,$user,$pass);
//echo "Your Connection Established";

if(isset($_POST['submit'])){

$name=$_POST['name'];

$school=$_POST['school'];

$roll=$_POST['roll'];

$result=$_POST['result'];

$query="insert into students (student_name,school_name,roll_no,result)
values ('$name','$school','$roll','$result')";

if(mysqli_query($query)){
echo "<h1>Your Data Inserted</h1>";
}
}
?>


Kindly Solve This Problem-
Thank You Very Much Sir.
Quote 0 0
Write a reply...

Add a Website Forum to your website.