mod_rewrite, part two
Date: 11/30/05
(PHP Community) Keywords: php
Hello everyone
As an update to my previous post, I've started playing with mod_rewrite, which so far is working out great, just got 1 problem though, passing variables through the page. Example, I had a page called main.php and each page is passed though using p.
Soo i can link's like this
main.php?p=1
main.php?p=2
main.php?p=3
and then using .htaccess I do the following
RewriteRule ^ict/mytasks$ main.php
RewriteRule ^ict/tasks/new$ main.php/?p=1
RewriteRule ^ict/tasks/edit$ main.php/?p=2
RewriteRule ^ict/tasks/completed$ main.php/?p=3
but now I has form's and such like, now before I just simply put in the form action
main.php?p=1&action=addtask
but now, how do I go about putting that into .htaccess, to grab action.
But...and this is a big thing I'm asking for, all of the page's have a common select box, for changing offices (dont ask :)) so I need that to work on everything, again simular thing
?p=$p&office=officename
where $p, the current page, so if I was on p=3 then it would be 3, obviously. Anyway, the first page, ict/mytasks, works, but anything else, nope, well it wont.
every other variable passed, other than p, are charactors/text, only p is a number.
Anyone any idea's?
Cheers.
Source: http://www.livejournal.com/community/php/372555.html