Sending Php Get Data To Server Using Html Links
I haven't wrote PHP GET requests in a while. So I'm a little rusty. But how do I send GET data using an Html link. If I use jQuery's get method's I know how to do it, but I was jus
Solution 1:
Put the parameters behind the url:
index.php?param1=yes¶m2=no
Then you can read the variables over $_GET
echo$_GET['param1'];
But this are PHP basics. Perhaps you should read the documentation before.
In jQuery with an ajax request its the same. You can put your parameters behind the url.
$.get('index.php?param1=yes¶m2=no', function(data) {
$('.result').html(data);
alert('Load was performed.');
});
If you want to read all GET Parameters you can use a foreach loop.
foreach($_GETas$key => $value) {
echo$key.":".$value;
}
Solution 2:
The simple ways is,
<ahref="page.php?string1=str&string2=str&string3=str"></a>
or a form doing,
<formaction="page.php"method="get"></form>
Post a Comment for "Sending Php Get Data To Server Using Html Links"