Incrementing Variables

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
compguru910
Forum Newbie
Posts: 7
Joined: Wed Aug 08, 2007 6:47 pm

Incrementing Variables

Post by compguru910 »

Im new to this forum, and pretty much to PHP and I have a general question. From my understanding, everytime you use a submit button, it "sets" the value of it, on the next page to be loaded. Now, if I set up an INPUT TYPE="image" and submit that with the name and value, shouldnt the $_POST return as "SET"? Im a little confused on how this works with the image type.
So far, im trying to do this
<?php

Code: Select all

if (isset ($_POST['back'])) {
     $variable = variable + 1;
     } else {
     $variable = variable + 2;
     }
?>
Here is my script for the button itself

<form method="post" action="player.php"><INPUT TYPE="image" src="player/back.jpg" name="back" value="1">

Now, if I click the button, shouldnt it "SET" the "back" variable and my above PHP script would work? Im confused, if anyones got any suggestions, I would appreciate it
User avatar
Christopher
Site Administrator
Posts: 13596
Joined: Wed Aug 25, 2004 7:54 pm
Location: New York, NY, US

Post by Christopher »

Image inputs do not return a value, they return the coordinates of where the button was clicked.

http://www.w3.org/TR/html4/interact/for ... trol-types
(#10850)
Post Reply