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
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!

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.