I am using many get values in one page and making up a hyperlink with adding ?var=value&… each time is time cosuming. I would like to use hyperlinks as a submit button in a form and html would attach the variables to the url right away.
Update: I used this method and it worked fine now.
<a href="index.php?
<? foreach($_GET as $gk=>$gv)
{
echo $gk."=".$gv."&";
}
?>
pager=
<? echo $i; ?>">
<? echo $i; ?>
</a>
Update 2:
Making url’s is too much of a work, now I decided to use hidden fields in current forms and getting get values as default for the hiddent values. For preserving the get values, I won’t be making a link. I’ll post same get values from a get form. it works just fine. and I like using standard forms because the standard things work best.
You could make a function in php that writes all the $_GET variables for you:
Then your HTML link could be:
Doing this will allow you to add more get variables to the end of the link, or you could pass custom arrays (so instead of all the $_GET, maybe only two or three parts of it), and you don’t need to use javascript or have a lot of HTML on a page that is unnecessary.
OR
If you were set on using a form, you could do create a form with a bunch of hidden elements:
Here is some CSS: