image button to form submit

  • olm75
  • Proficient
  • Proficient
  • olm75
  • Posts: 294

Post 3+ Months Ago

im having trouble with this image as a submit button, for some reason its not querying like a regular submit buttom, can someone please help...(when i put a normal submit button it submits the form and does proper query...but when i just have this image as a button it doesnt do the same here's the code;

Code: [ Select ]
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
<style type="text/css">
<!--
.mnupropertyType {    height: auto;
    width: auto;
}
.txtmaxPrice {    height: auto;
    width: auto;
}
.txtminPrice {    height: auto;
    width: auto;
}
-->
</style>
</head>

<body>
<form name="searchForm" action="Properties_Results.php" method="post">
 <table id="Table_" width="175" height="264" border="0" cellpadding="0" cellspacing="0">
  <tr>
   <td colspan="6"><img src="images/search.jpg" width="175" height="12" alt="" /></td>
  </tr>
  <tr>
   <td colspan="6"><img src="images/searchHeader.jpg" width="175" height="26" alt="" /></td>
  </tr>
  <tr>
   <td colspan="6"><img src="images/search-04.jpg" width="175" height="27" alt="" /></td>
  </tr>
  <tr>
   <td rowspan="10"><img src="images/search-05.jpg" width="11" height="198" alt="" /></td>
   <td background="images/search_05.jpg"><label>
    <select name="mnuPropertyType" size="1" class="mnupropertyType" id="mnuPropertyType">
     <option selected="selected"> </option>
     <option value="rent">rent</option>
     <option value="sale">sale</option>
    </select>
   </label></td>
   <td rowspan="4"><img src="images/search-07.jpg" width="10" height="88" alt="" /></td>
   <td colspan="2" background="images/search_07.jpg"><label></label>
     <select name="mnuBedroom" size="1" id="mnuBedroom">
      <option selected="selected"></option>
      <option value="1">1</option>
      <option value="2">2</option>
      <option value="3">3</option>
      <option value="4">4</option>
      <option value="5">5</option>
      <option value="6">6</option>
      <option value="7">7</option>
      <option value="8">8</option>
      <option value="9">9</option>
    </select></td>
   <td rowspan="10"><img src="images/search-09.jpg" width="12" height="198" alt="" /></td>
  </tr>
  <tr>
   <td><img src="images/search-10.jpg" width="71" height="25" alt="" /></td>
   <td colspan="2"><img src="images/search-11.jpg" width="71" height="25" alt="" /></td>
  </tr>
  <tr>
   <td background="images/minTxt.jpg"><label>
    <input name="minPrice" type="text" class="txtminPrice" id="minPrice" size="5" maxlength="11" />
   </label></td>
   <td colspan="2" background="images/maxTxt.jpg"><label>
    <input name="maxPrice" type="text" class="txtmaxPrice" id="maxPrice" size="5" maxlength="11" />
   </label></td>
  </tr>
  <tr>
   <td><img src="images/search-14.jpg" width="71" height="21" alt="" /></td>
   <td colspan="2"><img src="images/search-15.jpg" width="71" height="21" alt="" /></td>
  </tr>
  <tr>
   <td colspan="4" background="images/search_15.jpg"><label>
    <select name="txtState" size="1" id="txtState">
     <option selected="selected"> </option>
     <option value="Alabama">Alabama</option>
     <option value="Alaska">Alaska</option>
     <option value="Arizona">Arizona</option>
     <option value="Arkansas">Arkansas</option>
     <option value="6">California</option>
     <option value="7">Colorado</option>
     <option value="8">Connecticut</option>
     <option value="9">Delaware</option>
     <option value="Florida">Florida</option>
     <option value="11">Georgia</option>
     <option value="12">Hawaii</option>
     <option value="13">Idaho</option>
     <option value="14">Illinois</option>
     <option value="15">Indiana</option>
     <option value="16">Iowa</option>
     <option value="17">Kansas</option>
     <option value="18">Kentucky</option>
     <option value="19">Louisiana</option>
     <option value="20">Maine</option>
     <option value="21">Maryland</option>
     <option value="22">Massachusetts</option>
     <option value="23">Michigan</option>
     <option value="24">Minnesota</option>
     <option value="25">Mississippi</option>
     <option value="26">Missouri</option>
     <option value="27">Montana</option>
     <option value="28">Nebraska</option>
     <option value="29">Nevada</option>
     <option value="30">New Hampshire</option>
     <option value="31">New Jersey</option>
     <option value="32">New Mexico</option>
     <option value="33">New York</option>
     <option value="34">North Carolina</option>
     <option value="35">North Dakota</option>
     <option value="36">Ohio</option>
     <option value="37">Oklahoma</option>
     <option value="38">Oregon</option>
     <option value="39">Pennsylvania</option>
     <option value="40">Rhode Island</option>
     <option value="41">South Carolina</option>
     <option value="42">South Dakota</option>
     <option value="43">Tennessee</option>
     <option value="44">Texas</option>
     <option value="45">Utah</option>
     <option value="46">Vermont</option>
     <option value="47">Virginia</option>
     <option value="48">Washington</option>
     <option value="52">Washington D.C.</option>
     <option value="49">West Virginia</option>
     <option value="50">Wisconsin</option>
     <option value="51">Wyoming</option>
            </select>
   </label></td>
  </tr>
  <tr>
   <td colspan="4"><img src="images/search-17.jpg" width="152" height="27" alt="" /></td>
  </tr>
  <tr>
   <td colspan="4" background="images/search_17.jpg"><label>
    <input name="txtCity" type="text" class="txtmaxPrice" id="txtCity" size="15" maxlength="30" />
   </label></td>
  </tr>
  <tr>
   <td colspan="4"><img src="images/search-19.jpg" width="152" height="9" alt="" /></td>
  </tr>
  <tr>
   <td colspan="3" rowspan="2"><img src="images/search-20.jpg" width="86" height="30" alt="" /></td>
   <!--this put in to make image button for the searchForm-->
   <td><a href="javascript:" onclick="document.searchForm.submit()"><img border="0" img="img" src="images/btn_searchSubmit.jpg" /></a></td>
   <!--<td><img src="images/btn_searchSubmit.jpg" alt="" width="66" height="17" border="0" /></td>-->
  </tr>
  <tr>
   <td><img src="images/search-22.jpg" width="66" height="13" alt="" /></td>
  </tr>
  <tr>
   <td><img src="images/spacer.gif" width="11" height="1" alt="" /></td>
   <td><img src="images/spacer.gif" width="71" height="1" alt="" /></td>
   <td><img src="images/spacer.gif" width="10" height="1" alt="" /></td>
   <td><img src="images/spacer.gif" width="5" height="1" alt="" /></td>
   <td><img src="images/spacer.gif" width="66" height="1" alt="" /></td>
   <td><img src="images/spacer.gif" width="12" height="1" alt="" /></td>
  </tr>
 </table>
 </form>
</body>
</html>
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  2. <html xmlns="http://www.w3.org/1999/xhtml">
  3. <head>
  4. <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  5. <title>Untitled Document</title>
  6. <style type="text/css">
  7. <!--
  8. .mnupropertyType {    height: auto;
  9.     width: auto;
  10. }
  11. .txtmaxPrice {    height: auto;
  12.     width: auto;
  13. }
  14. .txtminPrice {    height: auto;
  15.     width: auto;
  16. }
  17. -->
  18. </style>
  19. </head>
  20. <body>
  21. <form name="searchForm" action="Properties_Results.php" method="post">
  22.  <table id="Table_" width="175" height="264" border="0" cellpadding="0" cellspacing="0">
  23.   <tr>
  24.    <td colspan="6"><img src="images/search.jpg" width="175" height="12" alt="" /></td>
  25.   </tr>
  26.   <tr>
  27.    <td colspan="6"><img src="images/searchHeader.jpg" width="175" height="26" alt="" /></td>
  28.   </tr>
  29.   <tr>
  30.    <td colspan="6"><img src="images/search-04.jpg" width="175" height="27" alt="" /></td>
  31.   </tr>
  32.   <tr>
  33.    <td rowspan="10"><img src="images/search-05.jpg" width="11" height="198" alt="" /></td>
  34.    <td background="images/search_05.jpg"><label>
  35.     <select name="mnuPropertyType" size="1" class="mnupropertyType" id="mnuPropertyType">
  36.      <option selected="selected"> </option>
  37.      <option value="rent">rent</option>
  38.      <option value="sale">sale</option>
  39.     </select>
  40.    </label></td>
  41.    <td rowspan="4"><img src="images/search-07.jpg" width="10" height="88" alt="" /></td>
  42.    <td colspan="2" background="images/search_07.jpg"><label></label>
  43.      <select name="mnuBedroom" size="1" id="mnuBedroom">
  44.       <option selected="selected"></option>
  45.       <option value="1">1</option>
  46.       <option value="2">2</option>
  47.       <option value="3">3</option>
  48.       <option value="4">4</option>
  49.       <option value="5">5</option>
  50.       <option value="6">6</option>
  51.       <option value="7">7</option>
  52.       <option value="8">8</option>
  53.       <option value="9">9</option>
  54.     </select></td>
  55.    <td rowspan="10"><img src="images/search-09.jpg" width="12" height="198" alt="" /></td>
  56.   </tr>
  57.   <tr>
  58.    <td><img src="images/search-10.jpg" width="71" height="25" alt="" /></td>
  59.    <td colspan="2"><img src="images/search-11.jpg" width="71" height="25" alt="" /></td>
  60.   </tr>
  61.   <tr>
  62.    <td background="images/minTxt.jpg"><label>
  63.     <input name="minPrice" type="text" class="txtminPrice" id="minPrice" size="5" maxlength="11" />
  64.    </label></td>
  65.    <td colspan="2" background="images/maxTxt.jpg"><label>
  66.     <input name="maxPrice" type="text" class="txtmaxPrice" id="maxPrice" size="5" maxlength="11" />
  67.    </label></td>
  68.   </tr>
  69.   <tr>
  70.    <td><img src="images/search-14.jpg" width="71" height="21" alt="" /></td>
  71.    <td colspan="2"><img src="images/search-15.jpg" width="71" height="21" alt="" /></td>
  72.   </tr>
  73.   <tr>
  74.    <td colspan="4" background="images/search_15.jpg"><label>
  75.     <select name="txtState" size="1" id="txtState">
  76.      <option selected="selected"> </option>
  77.      <option value="Alabama">Alabama</option>
  78.      <option value="Alaska">Alaska</option>
  79.      <option value="Arizona">Arizona</option>
  80.      <option value="Arkansas">Arkansas</option>
  81.      <option value="6">California</option>
  82.      <option value="7">Colorado</option>
  83.      <option value="8">Connecticut</option>
  84.      <option value="9">Delaware</option>
  85.      <option value="Florida">Florida</option>
  86.      <option value="11">Georgia</option>
  87.      <option value="12">Hawaii</option>
  88.      <option value="13">Idaho</option>
  89.      <option value="14">Illinois</option>
  90.      <option value="15">Indiana</option>
  91.      <option value="16">Iowa</option>
  92.      <option value="17">Kansas</option>
  93.      <option value="18">Kentucky</option>
  94.      <option value="19">Louisiana</option>
  95.      <option value="20">Maine</option>
  96.      <option value="21">Maryland</option>
  97.      <option value="22">Massachusetts</option>
  98.      <option value="23">Michigan</option>
  99.      <option value="24">Minnesota</option>
  100.      <option value="25">Mississippi</option>
  101.      <option value="26">Missouri</option>
  102.      <option value="27">Montana</option>
  103.      <option value="28">Nebraska</option>
  104.      <option value="29">Nevada</option>
  105.      <option value="30">New Hampshire</option>
  106.      <option value="31">New Jersey</option>
  107.      <option value="32">New Mexico</option>
  108.      <option value="33">New York</option>
  109.      <option value="34">North Carolina</option>
  110.      <option value="35">North Dakota</option>
  111.      <option value="36">Ohio</option>
  112.      <option value="37">Oklahoma</option>
  113.      <option value="38">Oregon</option>
  114.      <option value="39">Pennsylvania</option>
  115.      <option value="40">Rhode Island</option>
  116.      <option value="41">South Carolina</option>
  117.      <option value="42">South Dakota</option>
  118.      <option value="43">Tennessee</option>
  119.      <option value="44">Texas</option>
  120.      <option value="45">Utah</option>
  121.      <option value="46">Vermont</option>
  122.      <option value="47">Virginia</option>
  123.      <option value="48">Washington</option>
  124.      <option value="52">Washington D.C.</option>
  125.      <option value="49">West Virginia</option>
  126.      <option value="50">Wisconsin</option>
  127.      <option value="51">Wyoming</option>
  128.             </select>
  129.    </label></td>
  130.   </tr>
  131.   <tr>
  132.    <td colspan="4"><img src="images/search-17.jpg" width="152" height="27" alt="" /></td>
  133.   </tr>
  134.   <tr>
  135.    <td colspan="4" background="images/search_17.jpg"><label>
  136.     <input name="txtCity" type="text" class="txtmaxPrice" id="txtCity" size="15" maxlength="30" />
  137.    </label></td>
  138.   </tr>
  139.   <tr>
  140.    <td colspan="4"><img src="images/search-19.jpg" width="152" height="9" alt="" /></td>
  141.   </tr>
  142.   <tr>
  143.    <td colspan="3" rowspan="2"><img src="images/search-20.jpg" width="86" height="30" alt="" /></td>
  144.    <!--this put in to make image button for the searchForm-->
  145.    <td><a href="javascript:" onclick="document.searchForm.submit()"><img border="0" img="img" src="images/btn_searchSubmit.jpg" /></a></td>
  146.    <!--<td><img src="images/btn_searchSubmit.jpg" alt="" width="66" height="17" border="0" /></td>-->
  147.   </tr>
  148.   <tr>
  149.    <td><img src="images/search-22.jpg" width="66" height="13" alt="" /></td>
  150.   </tr>
  151.   <tr>
  152.    <td><img src="images/spacer.gif" width="11" height="1" alt="" /></td>
  153.    <td><img src="images/spacer.gif" width="71" height="1" alt="" /></td>
  154.    <td><img src="images/spacer.gif" width="10" height="1" alt="" /></td>
  155.    <td><img src="images/spacer.gif" width="5" height="1" alt="" /></td>
  156.    <td><img src="images/spacer.gif" width="66" height="1" alt="" /></td>
  157.    <td><img src="images/spacer.gif" width="12" height="1" alt="" /></td>
  158.   </tr>
  159.  </table>
  160.  </form>
  161. </body>
  162. </html>
  • Anonymous
  • Bot
  • No Avatar
  • Posts: ?
  • Loc: Ozzuland
  • Status: Online

Post 3+ Months Ago

  • Netlyte
  • Graduate
  • Graduate
  • Netlyte
  • Posts: 179

Post 3+ Months Ago

Instead of :
Code: [ Select ]
<a href="javascript:" onclick="document.searchForm.submit()"><img border="0" img="img" src="images/btn_searchSubmit.jpg" /></a>

try this

Code: [ Select ]
<a href="javascript:document.searchForm.submit();"><img border="0" img="img" src="images/btn_searchSubmit.jpg" /></a>
  • crazzyDemon
  • Beginner
  • Beginner
  • User avatar
  • Posts: 55

Post 3+ Months Ago

hi

you can try another two variants

first:

set id to your form, like:

Code: [ Select ]
<form name="searchForm" id="searchForm" action="Properties_Results.php" method="post">

and on image write next:

Code: [ Select ]
<a href="#" onclick="javascript: document.getElementById('searchForm').submit(), return false;">
  <img border="0" img="img" src="images/btn_searchSubmit.jpg" alt="" />
</a>
  1. <a href="#" onclick="javascript: document.getElementById('searchForm').submit(), return false;">
  2.   <img border="0" img="img" src="images/btn_searchSubmit.jpg" alt="" />
  3. </a>


OR

instead of image use


Code: [ Select ]
<form name="searchForm" action="Properties_Results.php" method="post">
...
<input type="image" src="images/btn_searchSubmit.jpg" />
</form>
  1. <form name="searchForm" action="Properties_Results.php" method="post">
  2. ...
  3. <input type="image" src="images/btn_searchSubmit.jpg" />
  4. </form>


input type image work like input type submit[/b]

Post Information

  • Total Posts in this topic: 3 posts
  • Users browsing this forum: No registered users and 38 guests
  • You cannot post new topics in this forum
  • You cannot reply to topics in this forum
  • You cannot edit your posts in this forum
  • You cannot delete your posts in this forum
  • You cannot post attachments in this forum
 
cron
 

© 1998-2014. Ozzu® is a registered trademark of Unmelted, LLC.