Page 1 of 1
submit via picture?!
Posted: Fri Oct 06, 2006 2:55 am
by SomeOne
i have the code like
Code: Select all
<form method="post" action="dodajSliko.php">
<input type="image" name="slikaNova" src="./pic1.jpg" height='100'value="./pic1.jpg"/>
<input type="image" name="slikaNova" src="./pic2.jpg" height='100'value="./pic2.jpg"/>
<input type="image" name="slikaNova" src="./pic3.jpg" height='100'value="./pic3.jpg"/>
<input type="image" name="slikaNova" src="./pic4.jpg" height='100'value="./pic4.jpg"/>
<form>
this pictures are alsow "submit" button...that means when you click on an image it processes the form and it work in mozilla, though on IE dosent..
I heard that this type of submission is not allowed or something, cos IE dosend send the value...
or something...
can anyone help me?
i really dont want to make extra hyperlih for each image to proceed....
Posted: Fri Oct 06, 2006 2:57 am
by RobertGonzalez
They are all named the same. Try changing their names.
Posted: Fri Oct 06, 2006 3:15 am
by Rovas
If you want to submit the form when the user clicks a picture put the following Javascript code if you send them to the same page :
Code: Select all
<input type='image' name='pic1' id='pic1' onclick="document.form[0].submit()" height='100'value="./pic1.jpg"/>
Code: Select all
if (!empty($_GET['pic'])) {/*your code*/ }
Posted: Fri Oct 06, 2006 4:34 am
by SomeOne
Everah wrote:They are all named the same. Try changing their names.
i dont think this is an issue, becous you can click only on one image at a time...
somebody say tat IE dosent send value of the value taht is set but sends the xy coordinates in pixels depending on position of clikc on the picture

Posted: Fri Oct 06, 2006 5:54 am
by brendandonhue
Yes, it's not just IE. Browsers send the coordinates of where the user clicked the image.
I did this one time.
Posted: Fri Oct 06, 2006 4:01 pm
by churt
I would do this instead.
Code: Select all
<form method="post" action="dodajSliko.php">
<input type="image" name="slikaNova1" src="./pic1.jpg" height='100'value="./pic1.jpg"/>
<input type="image" name="slikaNova2" src="./pic2.jpg" height='100'value="./pic2.jpg"/>
<input type="image" name="slikaNova3" src="./pic3.jpg" height='100'value="./pic3.jpg"/>
<input type="image" name="slikaNova4" src="./pic4.jpg" height='100'value="./pic4.jpg"/>
<form>
Use this code to detect which image was selected.
Code: Select all
foreach($_POST as $key => $value){
if ($key=='slikaNova1_x') $slikaNova1='whatever';
if ($key=='slikaNova2_x') $slikaNova2='whatever';
if ($key=='slikaNova3_x') $slikaNova3='whatever';
if ($key=='slikaNova4_x') $slikaNova4='whatever';
}
Posted: Fri Oct 06, 2006 7:16 pm
by brendandonhue
You would probably want to add some validation to that, as it would allow a user to submit more than 1 of the image fields to your script.
Posted: Fri Oct 06, 2006 7:51 pm
by timvw
From what i remember is that IE appends _x and _y to the input name... Thus check if $_POST['slikaNova1'] or $_POST['slikaNova1_x'] exists...