How to make a anchor tag refreshes like a submit button

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    How to make a anchor tag refreshes like a submit button

    anyone knows how to do this in php?

    #2
    Originally posted by Pablo View Post
    anyone knows how to do this in php?

    This problem can be achieved by java script see the script snippet below. When link is clicked, it will call java script function, within java script function
    HTML Code:
    document.forms["gtriddim"].submit();
    will be used to auto submit the form values.......

    Javascript code

    HTML Code:
    <script type="text/javascript">
    
    function submitform()
    {
    document.forms["gtriddim"].submit();
    alert("Value has been sumitted");
    }
    </script>

    Your Form Code using the Anchor Tag as submit button

    HTML Code:
    <form id="gtriddim" action="submit.php" method="post">
    
    <input type="text" name="query">
    
    <a href="javascript: submitform()">Submit</a>
    
    </form>
    Now the below code is your "submit.php" form which will collect the values from the above code

    PHP Code:
    <?php

    $details  
    $_POST['query'];

    echo 
    "Submitted values is $details";

    ?>

    That's it.........

    Comment


      #3
      thanx bro (y)

      Comment

      Working...
      X