What Am i doing wrong?
Posted: Sun Mar 28, 2004 12:18 pm
I would highly appreciate any kind of help.
This is where i input my call_no of the book on which i want to make some modification. the test.php page is called upon click on getvalue button...
Can anybody tell why am i not getting the expected msg when i click on update button?
This is where i input my call_no of the book on which i want to make some modification. the test.php page is called upon click on getvalue button...
Code: Select all
<?php
<form method="post" action="test.php">
<table border="0" width="75%">
<tr>
<td width="15%">
<p align="right">Call No:</p>
</td>
<td width="57%"><input type="text" name="call_no" size="20"></td>
</tr>
<tr>
<td width="15%">
</td>
<td width="57%">
<input type="submit" value="Get Value" name="getvalue">
</p>
</form>
?>Can anybody tell why am i not getting the expected msg when i click on update button?
Code: Select all
<?php
<html>
<head></head>
<body>
<?php
if (isset($_POST['Update'])) {
echo "Update works now!! congratulations!!!!\n";
}
else {
$db = mysql_connect("localhost", "root");
mysql_select_db("library",$db);
$sql = "SELECT * FROM book WHERE call_no=('{$_POST['call_no']}')";
$result = mysql_query($sql);
while ($myrow = mysql_fetch_row($result))
{
echo
'<table border="0" width="75%">
<tr>
<td width="15%">Call No</td>
<td width="62%"><input type="text" name="call_no" value ="'.$myrow[0].'" size="20"></td>
</tr>
<tr>
<td width="15%">Book Title</td>
<td width="62%"><input type="text" name="title" value ="'.$myrow[1].'"size="20"></td>
</tr>
<tr>
<td width="15%">Author1</td>
<td width="62%"><input type="text" name="author1" value ="'.$myrow[2].'" size="20"></td>
</tr>
<tr>
<td width="15%">Author2</td>
<td width="62%"><input type="text" name="author2" value= "'.$myrow[3].'"size="20"></td>
</tr>
<tr>
<td width="15%">Publisher</td>
<td width="85%" colspan="2"><input type="text" name="publisher" value ="'.$myrow[4].'"size="20"></td>
</tr>
<tr>
<td width="15%">ISBN</td>
<td width="85%" colspan="2"><input type="text" name="isbn" value = "'.$myrow[5].'"size="20"></td>
</tr>
<tr>
<td width="15%">Price</td>
<td width="85%" colspan="2"><input type="text" name="price" value ="'.$myrow[6].'"size="20"></td>
</tr>
<tr>
<td width="15%">No of Page</td>
<td width="85%" colspan="2"><input type="text" name="no_of_page" value="'.$myrow[7].'" size="20"></td>
</tr>
<tr>
<td width="15%">Edition</td>
<td width="85%" colspan="2"><input type="text" name="edition" value="'.$myrow[8].'"size="20"></td>
</tr>
<tr>
<td width="15%">Category</td>
<td width="85%" colspan="2"><input type="text" name="category" value="'.$myrow[9].'" size="20"></td>
</tr>
</table>
<p>
';
} //end of while loop
} // end if
?>
<input type="submit" value="Update" name="Update">
</body>
?>