I am very new to php so this is probably me just getting something simple wrong but here is my problem.
I have a page with a form that displays records from a database and on this page I have a form with buttons to let the user go on to the next record or back to the previous one. The method I'm trying to employ to do this is using a hidden item in the form that holds the record number. However when the page refreshes following the pushing of a button the record number variable is set but doesn't contain anything.
Could someone please point me to where I'm going wrong?
Here is my code and it's saved in a file called Review.php.
Thanks
M![[wiggle] [wiggle] [wiggle]](/data/assets/smilies/wiggle.gif)
I have a page with a form that displays records from a database and on this page I have a form with buttons to let the user go on to the next record or back to the previous one. The method I'm trying to employ to do this is using a hidden item in the form that holds the record number. However when the page refreshes following the pushing of a button the record number variable is set but doesn't contain anything.
Could someone please point me to where I'm going wrong?
Here is my code and it's saved in a file called Review.php.
Code:
<?php
$scanNo = 1;
if(isset($_POST['submit']))
{
if(isset($_POST['ScanNo'])&& ($_POST['ScanNo']) != "" && ($_POST['ScanNo']) != null)
{
$scanNo = $_Post['ScanNo'];
if($_POST['submit'] == "Next"){ $scanNo = $scanNo +1;}
if($_POST['submit'] == "Previous"){ $scanNo = $scanNo -1;}
}
}
?>
<html>
<head>
<title>View database records</Title>
</head>
<body>
<form action="Review.php" method="POST">
<input type="hidden" name="ScanNo" value="<?php echo $scanNo; ?>">
<input type="submit" name="submit" value ="Next">
<input type="submit" name="submit" value ="Previous">
</form>
</body>
</html>
Thanks
M
![[wiggle] [wiggle] [wiggle]](/data/assets/smilies/wiggle.gif)