Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 8 of 8
  1. #1
    Regular Coder
    Join Date
    Mar 2009
    Posts
    107
    Thanks
    15
    Thanked 0 Times in 0 Posts

    image submit not working

    Hey guys, im putting a script together and everything was working fine.

    heres an extract of what i had:

    PHP Code:


    if(isset($_POST['submit']) && $_POST['info'] == "go") { 
    Code:
       
    <form id="form1" name="form1" method="post" action="">
    <input type="hidden" name="info" id="info" value="go" />
    <input type="hidden" name="id" id="id" value="<? echo $row['id_product']; ?>" />
    <input type="submit" width="95" height="29" name="submit" id="submit" value="go">
    then i changed the submit from:
    Code:
    <input type="submit"  width="95" height="29" name="submit" id="submit" value="go">
    TO
    Code:
    <input type="image" SRC="images/go.gif" width="95" height="29" name="submit" id="submit" value="go">
    and the script stopped working, so i tried setting the if script to if post image ..rather than if post submit..but that didnt work.
    ive never used image submit buttons in the past.
    dose anybody have any idea where i have gone wrong.
    thanks in advance for any help!

  • #2
    Regular Coder low tech's Avatar
    Join Date
    Dec 2009
    Posts
    852
    Thanks
    173
    Thanked 94 Times in 94 Posts

  • Users who have thanked low tech for this post:

    IamHe (07-26-2011)

  • #3
    Senior Coder
    Join Date
    Jul 2011
    Posts
    1,226
    Thanks
    3
    Thanked 171 Times in 171 Posts
    You should never check for $_post submit. Some browsers won't pass it if your user presses enter. You should ALWAYS check for a required value in your form only - a value that your user needs to have entered to continue. For you, it looks like post info.

    Remove the post submit isset and leave the isset info and it should work.

  • Users who have thanked BluePanther for this post:

    IamHe (07-26-2011)

  • #4
    Senior Coder
    Join Date
    Feb 2011
    Location
    Your Monitor
    Posts
    4,327
    Thanks
    60
    Thanked 525 Times in 512 Posts
    Blog Entries
    4
    As BP says, don't use the submit button to test for form submissions. IE has a nasty tendency not to send it when the user hits enter on the keyboard.
    See my new CodingForums Blog: http://www.codingforums.com/blogs/tangoforce/

    Many useful explanations and tips including: Cannot modify headers - already sent, The IE if (isset($_POST['submit'])) bug explained, unexpected T_CONSTANT_ENCAPSED_STRING, debugging tips and much more!

  • #5
    Regular Coder
    Join Date
    Mar 2009
    Posts
    107
    Thanks
    15
    Thanked 0 Times in 0 Posts
    Perfect!
    Thankyou!

  • #6
    Regular Coder
    Join Date
    Mar 2009
    Posts
    107
    Thanks
    15
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by low tech View Post
    worked great! thanks for your help

  • #7
    Senior Coder
    Join Date
    Jul 2011
    Posts
    1,226
    Thanks
    3
    Thanked 171 Times in 171 Posts
    Quote Originally Posted by IamHe View Post
    worked great! thanks for your help
    Remember, don't use $_POST['submit'] or anything that equates for a user pressing a submit button. It will not work in some browsers.

  • #8
    Regular Coder
    Join Date
    Mar 2009
    Posts
    107
    Thanks
    15
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by BluePanther View Post
    Remember, don't use $_POST['submit'] or anything that equates for a user pressing a submit button. It will not work in some browsers.
    i have always used that way in the past!
    lol, i suppose its better to learn later than never!
    thanks for your help


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •