Forum Moderators: coopster
<form action="<?php echo $editFormAction;?>" method="POST" etc couple with this code in the head (also courtesy of DWMX 2004:
$editFormAction = $_SERVER['PHP_SELF'];
if (isset($_SERVER['QUERY_STRING'])) {
$editFormAction .= "?" . htmlentities($_SERVER['QUERY_STRING']);
} completely ruins my people/search-engine friendly URLs (created with mod_rewrite thru .htaccess) and turns my URLs back into query strings? how do I avoid this?
site.com/level1/level2/page-with-form/ site.com/level1/index.php p.s. although search engines are a worry, i think it is more important not to bombard visitors to my site with horribly ugly urls that could confuse them.
The solution would be to rebuild the "friendly" URL using the query string variables. Using your example:
suppose...
site.com/level1/level2/page-with-form/
...gets rewritten to...
/index.php?lev_1=level1&lev_2=level2&lev_3=page-with-form
In the script, the form action would be...
$editFormAction = '/' . $_GET['lev_1'] . '/' . $_GET['lev_2'] . '/' . $_GET['lev_3'] . '/';
Which would give you the original URL...
/level1/level2/page-with-form/
I hope that helps a bit.