www.webdeveloper.com
Results 1 to 11 of 11

Thread: Input type="image" problem

  1. #1
    Join Date
    Feb 2006
    Location
    india
    Posts
    678

    Input type="image" problem

    Hi all,

    I am not getting POST values as i have given

    <form name="form1" method="post" action="search.php">
    ................................
    ................................
    <input type="image" border="0" name="submit" src="images/searchused.jpg" width="100" height="17" >

    In search.php

    if(isset($_POST['submit']))
    {
    No posted values are coming
    }

    I think there is a way out using javascript....if so then what should i do now?

    Also is there any way to get the posted values in the above way using php.i like to avoid javascript coz IE sometimes doesnot support js.

    Please suggest me what should i need to do now.

    Thanks for your co-operation.
    Regards
    Raj

  2. #2
    Join Date
    Apr 2006
    Posts
    63
    Try:
    HTML Code:
    onSubmit="form1.submit()"
    inside the < input > you have there.

  3. #3
    Join Date
    Aug 2005
    Location
    The Garden State
    Posts
    5,634
    try submit_x and submit_y instead of just submit. the problem is that you're not giving the image a value attribute.
    Acceptable Use | SQL Forum FAQ | celery is tasteless | twitter

    celery is tasteless - currently needing some UI time

  4. #4
    Join Date
    Jan 2005
    Location
    Alicante (Spain)
    Posts
    7,739
    Change to this:
    HTML Code:
    <input type="image" border="0" src="images/searchused.jpg" width="100" height="17" >
    PHP Code:
    if(isset($_POST['x'])) 
    Or use a button

    HTML Code:
    <button type="submit" name="submit"><img src="file.png"></button>
    Last edited by bokeh; 05-23-2006 at 10:01 AM.

  5. #5
    Join Date
    Jan 2005
    Location
    Alicante (Spain)
    Posts
    7,739
    Quote Originally Posted by chazzy
    try submit_x and submit_y instead of just submit. the problem is that you're not giving the image a value attribute.
    It shouldn't need a value attribute... the coordinates are the values.

  6. #6
    Join Date
    Feb 2006
    Location
    india
    Posts
    678
    Hi Bokeh,

    I have applied as $_POST['x'] and its working.....great

    Thanks to all for your earnest co-operation.

    Regards
    Raj

  7. #7
    Join Date
    Aug 2005
    Location
    The Garden State
    Posts
    5,634
    Quote Originally Posted by bokeh
    It shouldn't need a value attribute... the coordinates are the values.
    If you want to handle it without using the coordinates (since not all browsers send the coordinates back) then the input should have a value.

    And really, semantically, all input should have values. Your'e not checking anymore if the submit is set but that it has coordinates.
    Acceptable Use | SQL Forum FAQ | celery is tasteless | twitter

    celery is tasteless - currently needing some UI time

  8. #8
    Join Date
    Feb 2006
    Location
    india
    Posts
    678
    Bokeh just now i sent you an email

  9. #9
    Join Date
    Jan 2005
    Location
    Alicante (Spain)
    Posts
    7,739
    Quote Originally Posted by chazzy
    If you want to handle it without using the coordinates (since not all browsers send the coordinates back) then the input should have a value.

    And really, semantically, all input should have values. Your'e not checking anymore if the submit is set but that it has coordinates.
    Actually it's the other way around: the coordinates are always set. The Mozilla browsers act the best if a value is set but IE completely ignores it. In mozilla if the attributes are name="submit" value="myvalue" it sends ?submit=myvalue&submit_x=11&submit_y=23 so sending 3 values. By the way the name attribute is optional for type="submit", the only input type where it is optional.

  10. #10
    Join Date
    Aug 2005
    Location
    The Garden State
    Posts
    5,634
    type="submit" defaults name="submit" when not set.

    not true for image btw.
    Acceptable Use | SQL Forum FAQ | celery is tasteless | twitter

    celery is tasteless - currently needing some UI time

  11. #11
    Join Date
    Jan 2005
    Location
    Alicante (Spain)
    Posts
    7,739
    Quote Originally Posted by chazzy
    type="submit" defaults name="submit" when not set.
    No it doesn't... It doesn't send anything at all. It's as if it didn't exist. Also it applies to all <input type="submit">.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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



Recent Articles