As commented below, that is not a very good solution or elegant solution to this problem, as $_POST
usually causes the browser to act funny if you keep posting content to it. It may even quit loading the website period. So $_GET
should be just fine... You can always encrypt the URL
so if anyone is looking at the connection may not realize what they are looking at.
Yes, and no... At least not in the sense which I think you are trying to do, I may be wrong though. It will change the structure of whatever you are doing, to use $_POST
you have to submit it via a form, as per PHP:
$_POST
:
An associative array of variables passed to the current script via the HTTP POST method when using application/x-www-form-urlencoded or multipart/form-data as the HTTP Content-Type in the request.
So you could in theory submit a form with the lang
value, and change from
$lang=$_GET['lang'];
To:
$lang=$_POST['lang'];
So instead of having simple links, setup a form with a buttons, or a dropdown:
<form id="web_lang" method="post">
<button name="lang" value="en">English</button>
<button name="lang" value="ar">Arabic</button>
<button name="lang" value="ch">Chinese</button>
</form>
NOTE: Do not use $_GET
or $_POST
unfiltered, those are user inputs, and you NEVER trust user input, they can pass malicious code and do some serious harm to your website.