HTML form not working with image submit button?

前端 未结 3 1415
余生分开走
余生分开走 2021-01-27 05:53

I have the following html form i am testing out.







        
相关标签:
3条回答
  • 2021-01-27 06:06

    Just add this inside the form:

    <input type="hidden" name="submit" value="submit"/>
    

    So that it receives the $_POST['submit'] in your PHP.

    0 讨论(0)
  • 2021-01-27 06:08
    <input type = "image" src = "uploads/defb.png"  name = "submit" value = "submit"/>
    

    change to:

    <input type = "submit"  name = "submit" value = "submit"/>
    

    Because input didint have this type

    create style for input HTML

    <input type = "submit"  name = "submit" value = "submit" id="button" />
    

    CSS

    #button {
    
    background:url("uploads/defb.png");
    border:0;
    outline:0;
    
    }
    
    0 讨论(0)
  • 2021-01-27 06:12

    When using a input type="image", the browser sends submit_x and submit_y.

    So in PHP, $_POST['submit'] will not be available, but $_POST['submit_x'] and $_POST['submit_y'] will be defined (containing the X/Y coordinates where the image was clicked on).

    0 讨论(0)
提交回复
热议问题