php - mod_rewite / query_string -
i basic results mysql database , list on page, on page i've added links variable user_id:
href=\"http://localhost/testing/template.php?user_id=$user_id\" >click here
on template.php file i'll $user_id , display relevant full data.
the thing don't want user_id=249 http://localhost/testing/template.php?**user_id=**249 show in url i'd "http://localhost/testing/template.php/249".
i've been looking few days no success, possible? or template file need user_id=$user_id displayed in order variable?
thanks!
=====================
to update: added code
rewriteengine on
rewritebase /testing/
rewriterule ^template.php/([0-9]+)(/)?$ template.php?user_id=$1 [l]
changed link variable href="localhost/testing/template.php/{$user_id}" >click here
the re-write works, i'm not getting variable $user_id = $_get["user_id"]; on template.php page
i added following template.php page see whats being passed through url:
<?php ini_set('display_errors',1); echo '<b>$_get variables</b><pre>'; var_dump( $_get ); echo '</pre>'; ?>
and got following response:
$_get variables
array(1) { ["user_id"]=> string(2) "21" }
any ideas how variable?
===========
to update works! {$user_id} in link not {user_id} - of swore tried both ways.
i don't want inpolite, there lot of manuals in interwebs, e.g.
http://httpd.apache.org/docs/2.0/mod/mod_rewrite.html
which explains, examples, need. have tried far? can explain what's wrong.
Comments
Post a Comment