otuatail Posted December 11, 2007 Share Posted December 11, 2007 I have a form Method="post" I have two images of buttons <input type="image" name="Topic" Value="4" src="images/new_topic2.gif" alt="" border="0"> <input type="image" name="Prefs" Value="6" src="images/Prefs2.gif" alt="" border="0"> I need to find out which image is clicked to take diffrent actions. I have tried. echo $_POST['Topic']; Is there a way. I dont want to use <input type="submit"> Quote Link to comment Share on other sites More sharing options...
cooldude832 Posted December 11, 2007 Share Posted December 11, 2007 do print_r($_POST) and see if its in that array, otherwise you will have to derive a different way to pass the value, maybe updating a hidden input on click or something Quote Link to comment Share on other sites More sharing options...
otuatail Posted December 11, 2007 Author Share Posted December 11, 2007 I am not sure what is going with print_r($_POST) but I get difrent results depending on which image I click Board [Prefs_x] => 28 [Prefs_y] => 12 Board [Topic_x] => 26 [Topic_y] => 12 This means that I Should be able to sort this. Quote Link to comment Share on other sites More sharing options...
cooldude832 Posted December 11, 2007 Share Posted December 11, 2007 well I dont see the button value carrying over so you will need to try a dual submit maybe Quote Link to comment Share on other sites More sharing options...
otuatail Posted December 11, 2007 Author Share Posted December 11, 2007 Correct but if it knows the co-ordinats of the position of the mouse, could I not find out something like if([Prefs_x] > 0) ...... if([Topic_x] >0) .... There sdeems someway out of this. Quote Link to comment Share on other sites More sharing options...
cooldude832 Posted December 11, 2007 Share Posted December 11, 2007 na you need to use js <input type="hidden" name="Button_Click" value="" /> <input type="button" onclick="submit_newtopic()" /> then make a newTopic() function in js to update the hdiden value and then submit the form Quote Link to comment Share on other sites More sharing options...
PFMaBiSmAd Posted December 11, 2007 Share Posted December 11, 2007 Read this for what is happening and how to use the data in php - http://us3.php.net/manual/en/faq.html.php#faq.html.form-image Your code should use isset(...) instead of checking for greater than zero, mainly because isset() won't produce an error when the variable is not set and fill up your web server log and slow your page down. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.