I have a code like this.
As per my previous question, I DONT WANT to send any values in the URL and going with the hidden field.
In the below code, when I submit the form, i was able to get the post values in the next page for the first row value only (first while loop record).
Why? When I inspect it with firebug I was able to see the hidden values for all the records.
In other words, only the first record is getting posted to the next page and not the consecutive records.
If the below code looks crazy, could someone help me in such a way that I don't want to pass the values in URL or anywhere in the browser/webform
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Books</title>
<script type="text/javascript">
function test() {
document.forms.testform.submit();
}
</script>
</head>
<body>
<?php
mysql_connect("localhost","root","password");
mysql_select_db("books");
$result = mysql_query("SELECT B_Code,Author_Name FROM books");
while($row = mysql_fetch_array( $result )) {
?>
<form action ="post.php" id="testform" method="post">
<input type="hidden" name="name" value="<?php echo $row['B_Code']; ?>" />
<input type="hidden" name="id" value="<?php echo $row['Author_Name']; ?>" />
</form>
<a href="#" onclick="test()"><?php echo $row['Author_Name']; ?></a>
<?php } ?>
</body>
</html>
Thanks, Kimz