Pavlos1316 Posted July 9, 2008 Share Posted July 9, 2008 Hi all I have this buton configuration: <input type="submit" name="submit" id="submit" value="Submit" on click="this.form.submit"/> is working fine...!! When i try to change my submit button to an image like that: input type="image" src="../../play button.bmp" height="25" width=" 130" alt="Submit Form" doesn't work. Can you help? Thank you. Quote Link to comment https://forums.phpfreaks.com/topic/113864-solved-submit-form-button/ Share on other sites More sharing options...
dannyb785 Posted July 9, 2008 Share Posted July 9, 2008 add onclick="this.form.submit()" to the input tag Quote Link to comment https://forums.phpfreaks.com/topic/113864-solved-submit-form-button/#findComment-585120 Share on other sites More sharing options...
Pavlos1316 Posted July 9, 2008 Author Share Posted July 9, 2008 Doesn't work Quote Link to comment https://forums.phpfreaks.com/topic/113864-solved-submit-form-button/#findComment-585134 Share on other sites More sharing options...
haku Posted July 9, 2008 Share Posted July 9, 2008 Please elaborate on 'it doesn't work'. I failed mind-reading 101 unfortunately. Quote Link to comment https://forums.phpfreaks.com/topic/113864-solved-submit-form-button/#findComment-585166 Share on other sites More sharing options...
Pavlos1316 Posted July 9, 2008 Author Share Posted July 9, 2008 The solution given by dannyb785 doesn't work!!! Quote Link to comment https://forums.phpfreaks.com/topic/113864-solved-submit-form-button/#findComment-585169 Share on other sites More sharing options...
Wolphie Posted July 9, 2008 Share Posted July 9, 2008 The solution given by dannyb785 doesn't work!!! What *exactly* doesn't work? Is there anything indicating where the problem is? What's wrong? Please be more clearer. If you're using Firefox, download the Firebug add-on, it will help you debug and determine the problem. Why are you adding a submit method to a submit button/image anyway? And I very much doubt that your first one worked, seeing as the form would submit regardless. Quote Link to comment https://forums.phpfreaks.com/topic/113864-solved-submit-form-button/#findComment-585183 Share on other sites More sharing options...
Pavlos1316 Posted July 9, 2008 Author Share Posted July 9, 2008 You can doupt as much as you like but... while I am testing with button everything is ok. When I try the image I must missing something so I don't get POST the checked checkboxes. That is the problem. I don't get the checkboxes posted when using image button Quote Link to comment https://forums.phpfreaks.com/topic/113864-solved-submit-form-button/#findComment-585186 Share on other sites More sharing options...
Wolphie Posted July 9, 2008 Share Posted July 9, 2008 Everything would be fine, because when you click the submit button, the data will be submitted regardless of whether you use an event handler or not. It doesn't matter, if you remove the onclick event handler, your form will still be submitted. This works *perfectly* fine for me: <form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="POST"> <input type="text" name="name" /> <input type="image" src="http://localhost/MAMP/images/welogo.gif" name="submit" /> </form> <?php if(isset($_POST['submit'])) { print $_POST['name']; } ?> Quote Link to comment https://forums.phpfreaks.com/topic/113864-solved-submit-form-button/#findComment-585192 Share on other sites More sharing options...
Pavlos1316 Posted July 9, 2008 Author Share Posted July 9, 2008 you have exactly what i have. when i use simple button everything is ok. when i replace it with image button my checkboxes don't get posted!!!!!!! Quote Link to comment https://forums.phpfreaks.com/topic/113864-solved-submit-form-button/#findComment-585208 Share on other sites More sharing options...
Wolphie Posted July 9, 2008 Share Posted July 9, 2008 Post your entire code then, rather than complaining about it. Quote Link to comment https://forums.phpfreaks.com/topic/113864-solved-submit-form-button/#findComment-585211 Share on other sites More sharing options...
Pavlos1316 Posted July 9, 2008 Author Share Posted July 9, 2008 this is what i have now: $away8=''; if (isset($_POST['submit'])) { if (isset($_POST['a'])) { $a = $_POST['a']; if ($a == 'a') { $a = '1'; } } } image button: <input type="image" src="../../play button.bmp" height="25" width="130" name="submit" /></th> still doesn't work. what i understant is... when i have the simple button... ok. when i am replacing with image button, somehow it is postin the first $a='' (which is null as you see) and not the other that follows if (isset($_POST['submit'])) Am I missing something? And I asure you that with simple button works perfectly!!! Quote Link to comment https://forums.phpfreaks.com/topic/113864-solved-submit-form-button/#findComment-585214 Share on other sites More sharing options...
Wolphie Posted July 9, 2008 Share Posted July 9, 2008 Post your form code too Quote Link to comment https://forums.phpfreaks.com/topic/113864-solved-submit-form-button/#findComment-585215 Share on other sites More sharing options...
Pavlos1316 Posted July 9, 2008 Author Share Posted July 9, 2008 here is a small part of it: <form id="form1" name="form1" method="post" action="proccess.php" target="_self"> <input type="checkbox" name="a" id="a" value="a" /> -</span> <input type="checkbox" name="b" id="b" value="b" /> <span class="style3">- </span> <input type="checkbox" name="c" id="c" value="c" /> Quote Link to comment https://forums.phpfreaks.com/topic/113864-solved-submit-form-button/#findComment-585221 Share on other sites More sharing options...
AndyB Posted July 9, 2008 Share Posted July 9, 2008 I wish I could find one of the many times I've answered questions about image submit ... When an image is clicked, the x and y coordinates of where it was clicked relative to its upper-left corner are passed along. That's how image maps work (and how compliant browsers treat image submits). With an image submit button, $_POST['submit'] has no value. The coordinate values do exist: you can check for either $_POST['submit_x'] or $_POST['submit_y']. That'll work - assuning that you have named your image submit as you did in your first example posted code for a 'normal' submit. Quote Link to comment https://forums.phpfreaks.com/topic/113864-solved-submit-form-button/#findComment-585223 Share on other sites More sharing options...
Pavlos1316 Posted July 9, 2008 Author Share Posted July 9, 2008 Thankssssssssssssss very very much.... If you have time can you explain in more simple words how the image works with x & y coordinates? Just to understand what happened. imagined it like it scans in x & y and posting what ever it finds... Thanks again Quote Link to comment https://forums.phpfreaks.com/topic/113864-solved-submit-form-button/#findComment-585230 Share on other sites More sharing options...
Pavlos1316 Posted July 9, 2008 Author Share Posted July 9, 2008 Oh... I also thank everybody who tried to help... if no one was trying... nothing would ever happen!!!! Quote Link to comment https://forums.phpfreaks.com/topic/113864-solved-submit-form-button/#findComment-585237 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.