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 Link to comment https://forums.phpfreaks.com/topic/130112-function-call-with-form-submit/ 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! Link to comment https://forums.phpfreaks.com/topic/130112-function-call-with-form-submit/#findComment-674666 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"]; ?> Link to comment https://forums.phpfreaks.com/topic/130112-function-call-with-form-submit/#findComment-674676 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 Link to comment https://forums.phpfreaks.com/topic/130112-function-call-with-form-submit/#findComment-674724 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.