I have a form
to enter a match number and submit via PHP GET
to the url, say test.php?match=
I added arrows for ease of use (time is important for the end user) that go up one match and down one match, and they work OK as long as you don't input a number first. The arrows add the number OK and I can start from 0 and go up, but if I start on another number it works once but deletes the number from the URL (for example, navigating to test.php?match=3
and pressing right arrow displays match 4 but the URL is changed to test.php?match=
)
Here is my code:
<?php
$next = $_GET["match"] + "1";
$last = $_GET["match"] - "1";
echo "<form action=\"test.php\" method=\"GET\">
Match<br>
<input style=\"font-size:24px;\" autofocus=\"autofocus\" type=\"number\" size=\"4\" name=\"match\" value=\"" . $_GET["match"] . "\">
<a href=\"sql.php?match=\"><button style=\"font-size:24px;\">Show All</button></a>
<a href=\"sql.php?match=" . $last . "\"><button style=\"font-size:24px;\"><</button></a>
<a href=\"sql.php?match=" . $next . "\"><button style=\"font-size:24px;\">></button></a>
<input style=\"font-size:24px;\" type=\"submit\" value=\"Submit\">
</form>";
?>
Thanks!