I don't understand how to send the form variables using isset
when we click on submit. When i click the submit button, a notice is appearing indicating:
Undefined index: rollno in C:\xampp\htdocs\test7.php on line 8.
My intention is to update the details by clicking on submit and update using isset
function and after updating return to the form again.
My code is here:
<html>
<head>
<style>
</style>
</head>
<body>
<form method="post" action="test7.php">
<center>Enter Roll Number: <input type="text" name="rollno" required/></center><br>
<center><input type="submit" name="submit" value="submit" id="submit" /></center>
</form>
</body>
</html>
test7.php starts here
<html>
<head>
</head>
<body>
<?php
include('connect.php');
$rno=$_POST['rollno'];
$sql="select * from stddetails where rollno='$rno'";
$query=mysql_query($sql);
$count=mysql_num_rows($query);
if($count>0)
{
$row=mysql_fetch_array($query);
}
?>
<center><form method='post'>
<table>
<tr><td>Roll Number</td><td><input type='text' name='roll' value='<?php echo $row['rollno']; ?>' disabled /></td></tr>
<tr><td>Student Name</td><td><input type='text' name='sname' value='<?php echo $row['sname']; ?>' size='80' /></td></tr>
<tr><td>Father Name</td><td><input type='text' name='fname' value='<?php echo $row['fname']; ?>' size='80'/></td></tr>
<tr><td>gender</td><td><input type='text' name='gender' value='<?php echo $row['gender']; ?>' /> </td></tr>
<tr><td>Aadhar</td><td><input type='text' name='aadhar' value='<?php echo $row['aadhar']; ?>' /> </td></tr>
<tr><td>SSC Htno</td><td><input type='text' name='ssc' value='<?php echo $row['sschtno']; ?>' /></td></tr>
<tr><td>SSC board</td><td><input type='text' name='board' value='<?php echo $row['sscboard']; ?>' /></td></tr>
<tr><td>SSC Grade</td><td><input type='text' name='grade' value='<?php echo $row['sscgrade']; ?>' /></td></tr>
<tr><td colspan='2'><center><input type='submit' name='Submit' value='Update' /></center></td></tr>
</table>
</form></center>
<?php
if(isset($_POST['Submit']))
{
echo"success";
}
?>
</body>
</html>