Never had a problem with chaning submit button before

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
katd
Forum Commoner
Posts: 34
Joined: Thu Nov 10, 2005 9:12 am

Never had a problem with chaning submit button before

Post 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
User avatar
Weirdan
Moderator
Posts: 5978
Joined: Mon Nov 03, 2003 6:13 pm
Location: Odessa, Ukraine

Post 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
}
katd
Forum Commoner
Posts: 34
Joined: Thu Nov 10, 2005 9:12 am

Post by katd »

Thank you very much for your help adding the extra submit worked brilliantly.
Post Reply