anyone knows how to do this in php?
How to make a anchor tag refreshes like a submit button
Collapse
X
-
Originally posted by Pablo View Postanyone 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 functionHTML Code:document.forms["gtriddim"].submit();
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>
PHP Code:<?php
$details = $_POST['query'];
echo "Submitted values is $details";
?>
That's it.........
Comment