Search code examples
phppostparametersget

PHP - GET parameter


i need help with my code:

Im including pages in index.php like:

if(isset($_GET['xx'])
{   
   // include('yy/'.$_GET['xx'].'.php');
}

and now in the file page.php i wanna use get parameters like from and to. i use htaccess for short url

RewriteRule ^([a-z]*)$ ./main.php?xx=$1

So i get this url in final:

index.php?xx=page?from=a&to=b

When i print_r($_GET) i got only first parameter xx

$_POST parameter works fine, but i need it with $_GET.


Solution

  • Solved! by misorude

    By specifying your own query string in the replacement, you are discarding the original one - this is default behavior with mod_rewrite. You need to specify the QSA flag to keep it. httpd.apache.org/docs/2.4/rewrite/flags.html#flag_qsa

    Thanks for fast responds without reading. Have a nice day!