How to make a anchor tag refreshes like a submit button

Started on the old forum in November 2012 · view the original in the archive · old links redirect here

2 replies · 2,846 views · started 14 years ago · 1 min read

2 participants
Pablo Developer · 164 posts #1

anyone knows how to do this in php?

Anthony Developer · 82 posts #2

Pablo wrote: 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

document.forms["gtriddim"].submit();

will be used to auto submit the form values.......

Javascript 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

<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

$details  = $_POST['query'];

echo "Submitted values is $details";

?>

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

FREE International SMS

GYSMS.com Provides FREE International sms Reach over 775 networks in more than 221 countries at no cost to you. and the Good News is we own our SMS Hardware so there is no third party SMS API involved our services are completely Ad supported.....

http://gysms.com

Send FREE International MMS and Share Files worldwide using our MMS Service.

http://gysms.net

GTriddim Live Online Radio Station

http://www.gtriddim.com

Pablo Developer · 164 posts #3

thanx bro (y)

Write your reply now; next you create a free account (or sign in) and it is posted right away. Sign in to reply.

Similar topics

Keyboard shortcuts

g f
Go to forums
g h
Go to your feed
g m
Go to messages
r
Reply (in a topic)
/
Search
j
Next post
k
Previous post
?
This list
Ctrl/⌘ + Enter
Send what you are writing
Ctrl/⌘ + B / I
Bold / italic while writing
Esc
Close