Mod rewrite and post

New to mod_rewrite? This is a good place to start.

Mod rewrite and post

Postby griffen » Tue Feb 23, 2010 3:03 pm

I'm trying to setup a mod rewrite with a post without any joy.

Current setup is as follows:

The URL is:

PHP Code:
http://localhost/testing/test123-page2/?sortOptions=priceLowToHigh


The rewrite rule is:

Code:
Code: Select all
RewriteRule ^([A-Za-z0-9]*)-page([0-9]*)/?$ formtest.php?prodType=$1&page=$2&show=$4&sort=$6 [L]


The Sortoptions value is posted in the URL but I'm unable to get the value.

Is this because the mod rewrite is preventing the value from being used?

If so how do perform a mod rewrite and submit variables through POST at the same time?



Page code as follows using an onchange on the select form:


PHP Code:
Code: Select all
<html>
<body>
<?php
$myfield1 = $_GET['sortOptions'];
$myfield2 = $_POST['sortOptions'];
echo "GET Myfield == " . $myfield1 . "<br />";
echo "POST Myfield == " . $myfield2 . "<br />";

//document.sortForm.submit();">
?>


<FORM
     NAME="sortForm"
     METHOD="GET">
    <SELECT NAME="sortOptions" onchange="javascript: this.form.submit();">
        <OPTION VALUE="priceHighToLow">Price High to Low</option>
        <OPTION VALUE="priceLowToHigh">Price Low to High</option>
    </SELECT>
</FORM>
</body>
</html>
griffen
 
Posts: 5
Joined: Sat Oct 03, 2009 8:06 am

Return to Beginner's Corner

Who is online

Users browsing this forum: Majestic-12 [Bot] and 3 guests

cron