Page 1 of 1

Never had a problem with chaning submit button before

Posted: Wed Nov 23, 2005 10:03 am
by katd
This may sound like a stupid with a really simple answer but i can't get my image to work as the submit problem. I've never had a problem before as the image has worked and i've used a variety of methods in the past including javascript but i have a login in page and want to submit the user id and password and the image doesn't do anything but the regular grey button works fine. This is my first php script and the php probably has nothing to do with it but would someone take a look to see what i'm doing wrong.

Code: Select all

<form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post">
                          <table width="100%"  border="0" cellspacing="0" cellpadding="0">
                          <tr>
                            <td><img src="images/parents_login/lion.jpg" width="80" height="63"></td>
                          </tr>
                          <tr>
                            <td><span class="login">Membership Log on ID</span></td>
                          </tr>
                          <tr>
                            <td><input type="text" name="username" size="15" maxlength="20" value="<?php if (isset($_POST['username'])) echo $_POST['username']; ?>" /></td>
                          </tr>
                          <tr>
                            <td><span class="login">user ID</span></td>
                          </tr>
                          <tr>
                            <td><input type="password" name="password" size="15" maxlength="20" /></td>
                          </tr>
                          <tr>
                            <td><span class="login">password</span></td>
                          </tr>
                          <tr>
                            <td><img src="images/white_spacer.gif" width="10" height="15"></td>
                          </tr>
                          <tr>
                            <td>   <a href="javascript:document.limousine.submit()" class="login_buttontxt">                                  </a>
                              <table width="130"  border="0" cellspacing="0" cellpadding="0">
                                <tr>
                                  <td align="left" valign="middle">Launch Parents page</td>
                                  <td width="20" align="right" valign="middle"><input type="image" src="images/parents_login/submit.gif" name="submit" /></td>
                                </tr>
                              </table></td>
                          </tr>
                        </table>
                        </form><!-- End of Form -->
Thanks

Posted: Wed Nov 23, 2005 10:35 am
by Weirdan
are you checking for $_POST['submit'] being set in your code? when using submit images some browsers are sending them as submit_x and submit_y pair, thus the check becomes:

Code: Select all

if(!empty($_POST['submit']) || !empty($_POST['submit_x'])) {
 // process the form here
}

Posted: Thu Nov 24, 2005 3:22 am
by katd
Thank you very much for your help adding the extra submit worked brilliantly.