echo "<td>$row['LastName']</td>";
echo "<td>$row['Age']....these lines print as it is...rather then displaying the records entered in the table....
Expand|Select|Wrap|Line Numbers
- <?php
- $con = mysql_connect("localhost","root","root");
- if (!$con)
- {
- die('Could not connect: ' . mysql_error());
- }
- if ($_POST['submit'])
- {
- $FirstName = $_POST['FirstName'];
- $query = "delete from student where FirstName ='$FirstName'";
- $result = mysql_query($query,$con);
- echo "Record has been deleted";
- //echo "<br/><br/><a href =customers3.php>Back to Customers Page</a>";
- }
- else{
- $sql = "select * from student";
- $result = mysql_query($sql,$con);
- mysql_close($con);
- ?>
Expand|Select|Wrap|Line Numbers
- <html>
- <head>
- </head>
- <body>
- <form name="Student info" action="delself.php" method="post">
- <table border=1 align='left'>
- <?php
- while($row = mysql_fetch_array($result))
- {
- echo "<tr><td>$row['FirstName']</td>;
- echo "<td>$row['LastName']</td>";
- echo "<td>$row['Age']</td>";
- echo "<td><input type='hidden' name='FirstName' value='$row[FirstName]'/></td>";
- echo "<td><input type='submit' name='submit' value='Delete'/></td>";
- echo </tr>";
- }
- echo "</table>";
- ?>
- </form>
- </body>
- </html>