Jump to content

Function call with form submit


Recreational_Champ

Recommended Posts

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

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!

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.