Re: how to get different submit button values, when images?

From: Date: Wed, 10 Oct 2001 17:22:49 +0000
Subject: Re: how to get different submit button values, when images?
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-70708@lists.php.net to get a copy of this message
I got stumped with this before, and as soon as I tell you the answer, you'll say "oh crap, right, I forgot" haha. type=submit name=submit echo $submit type=image name=submit echo $submit_x echo $submit_y type=image doesnt return the value='' it returns the cord of the image when pressed. this is just how HTML works. if you want to find out what type=image was pressed you'll need to make an array type=image name=submit[0] type=image name=submit[1] type=image name=submit[2] if (isset($submit_x[0])) if (isset($submit_x[1])) if (isset($submit_x[2])) that 'should' work. -- Chris Lee lee@mediawaveonline.com "Brian Leone" <brian.leone@lmco.com> wrote in message news:0C73AA5F720CD311AC2A0008C7DBA9B405CB59E3@emss09m13.ems.lmco.com... > I have a script that needs several different submit "buttons" in a single > form, and I need to have the script figure out which button they pushed. > However, I am trying to make all of the buttons images, but am having > trouble getting an image button carry a value with it... any ideas? > > this is what I have: the three submit buttons carry the correct value (ie, > value5) with them to the $submit variable, but the three image buttons > don't. > > -------------------------------------------------------------------------- -- > ------------------------------------------------------------- > <form method="post" action="test.phtml"> > <input type="image" src="blackdot2.jpg" width=20 height=20 > value="value1" > name="submit"> > <input type="image" src="blackdot2.jpg" width=20 height=20 > value="value2" > name="submit"> > <input type="image" src="blackdot2.jpg" width=20 height=20 > value="value3" > name="submit"> > <input type="submit" value="value4" name="submit"> > <input type="submit" value="value5" name="submit"> > <input type="submit" value="value6" name="submit"> > </form> > <? > echo $submit; > ?> > -------------------------------------------------------------------------- -- > ------------------------------------------------------------- > > Thanks. > brian > >

« previous php.general (#70708) next »