Recreational_Champ Posted October 25, 2008 Share Posted October 25, 2008 I would like to traverse images in my array by using form buttons for navigation i.e. up, down, left, or right. I have: <form action="<?php $_SERVER['PHP_SELF'] ?>" method="get" accept-charset="utf-8"> <p> <input type="submit" name="right" value="right"> <input type="submit" name="left" value="left"> <input type="submit" name="up" value="up"> <input type="submit" name="down" value="down"> <input type="submit" name="reset" value="reset"> </p> </form> What code would be required so that if the submit button right is pressed I would be able to call a function that does things every time right is pressed ? Thanks Quote Link to comment Share on other sites More sharing options...
kenshintomoe225 Posted October 25, 2008 Share Posted October 25, 2008 submit buttons do just that, submit the form. A submit button will always just do whatever the action is set for the form. I would ust <input type=button...> and then set an onclick attribute to a custom javascript function that submits the name of button that was clicked. Of course, there are more solutions possible! Quote Link to comment Share on other sites More sharing options...
FForce2195 Posted October 25, 2008 Share Posted October 25, 2008 <form action="filename.php" method="post"> <?php $right = $_POST["right"]; ?> Quote Link to comment Share on other sites More sharing options...
kenshintomoe225 Posted October 25, 2008 Share Posted October 25, 2008 you know what total brain fart Forgot about submit buttons having values Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.