Problem in images as a submit button

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • kavithadevan
    New Member
    • Jul 2007
    • 23

    #1

    Problem in images as a submit button

    Hi,
    Here i have pasted 2 scripts first one is design and next one is country.php
    in the below code is working nicely.
    ----------------------design.php------
    [code=html]<form name="form1" method="post" action="country .hp">
    <table width="200" border="1" align="center">
    <tr>
    <td>contrynam e</td>
    <td><input type="text" name="countryna me"></td>
    </tr>
    </table>
    <input type="submit" name="Submit" value="Submit">[/code]

    -------------------country.php----------

    [code=php]<form name="form1" method="post">
    <table width="90%" border="0" align="center" cellpadding="3" cellspacing="1" bgcolor="#CCCCC C">
    <tr>
    <div align="center">
    <h1>List Of Events</h1>
    </div>
    </tr>
    <?php
    include('connec t.php');
    $str=$_GET['countryname'];
    $sql="SELECT * FROM addevent where countryname LIKE'$str'";
    // OREDER BY id DESC is order result by descending
    $result=mysql_q uery($sql);
    $num=mysql_num_ rows($result);
    while($rows1=my sql_fetch_array ($result))
    {
    // Start looping table row
    ?>

    <tr>

    <td width="6%" align="center" bgcolor="#E6E6E 6"><strong>Even t</strong></td>
    <td width="23%" align="center" bgcolor="#E6E6E 6"><strong>Date </strong></td>
    <td width="15%" align="center" bgcolor="#E6E6E 6"><strong>Mont h</strong></td>
    <td width="13%" align="center" bgcolor="#E6E6E 6"><strong>Year </strong></td>
    </tr>


    <?PHP
    print "<tr bgcolor=\"#CCCC CC\">
    <td bgcolor=\"#FFFF FF\">" . $rows1['event'] ."</td>
    <td bgcolor=\"#FFFF FF\">" . $rows1['date'] ."</td>
    <td bgcolor=\"#FFFF FF\">" . $rows1['month'] ."</td>
    <td bgcolor=\"#FFFF FF\">" . $rows1['year'] ."</td>
    </tr>";
    // Exit looping and close connection
    }
    if($num!=0)
    {
    echo"<B> Totaly $num found</B> ";
    }
    else
    {

    echo"<center><B >No results found</B></center>";
    }
    mysql_close();


    ?>
    </table>

    </form>[/code]


    But i changes submit button into image and i dont want to give link in action field(if i give action its working) in this how can i redirect another one form using image as a submit button can anyone help me how to do this

    thanks
    Last edited by pbmods; Jul 21 '07, 04:50 PM. Reason: Added CODE tags.
  • adamalton
    New Member
    • Feb 2007
    • 93

    #2
    You should be able to get an image or a link to submit a form by using onclick="docume nt.formname.sub mit()" in the tag. You might be able to do [HTML]<a href="javascrip t:document.form name.submit()"> <img src="example.jp g></a>[/HTML] And in your form tag you would need to have [HTML]<form name="formname" >[/HTML]

    Comment

    • ak1dnar
      Recognized Expert Top Contributor
      • Jan 2007
      • 1584

      #3
      hey kavitha,
      May be its better to try this way.
      Its simple with a input elemenet type="image";

      [code=html]
      <form action="next.ph p" method="post" name="myform">
      <input name="myname" type="text" />
      <input name="myimgButt on" type="image" src="images_dir _path/btn_image.jpeg" />
      </form>
      [/code]

      thanks!
      -ajaxrand

      Comment

      • pbmods
        Recognized Expert Expert
        • Apr 2007
        • 5821

        #4
        Heya, Kavitha.

        Please use CODE tags when posting source code. See the REPLY GUIDELINES on the right side of the page next time you post.

        Comment

        Working...