Jay Wit
Jay Wit

Reputation: 3057

Htaccess form POST doesn't work?


I have a form with an action that redirects to a page;
<form method="post" action="active">

The "active" page is a rewritten rule;
RewriteRule ^active$ active_form-sec.php

The page with the form is also a RewriteRule.

The problem is, everytime I submit the form and I get on the active page, the POSTs are empty.
How can I fix this problem?
Thanks in advance!

Upvotes: 1

Views: 3202

Answers (3)

Mr.Singh
Mr.Singh

Reputation: 1781

This may help:

.htaccess:

Options +FollowSymlinks<br />
RewriteEngine On

RewriteCond %{THE_REQUEST} ^POST<br />
RewriteRule ^form-posting/?$ posting.php [L,NC]

form.php:

form method="post" action="form-posting"

posting.php:

print_r($_POST);

I have tried this code and it works.

Upvotes: 0

fabrik
fabrik

Reputation: 14365

  • Are you sure about active_form-sec.php is called when you hit the submit button?
  • If so what do you have when you do print_r($_POST)?
  • If active-form-sec.php isn't called, your mod_rewrite isn't working properly
  • If you got an empty array, there's a possibility something is wrong with your inputs (hint: missing name attributes)

Debug done.

Upvotes: 2

jackJoe
jackJoe

Reputation: 11148

that's probably because the .htaccess doens't collect the form data.

Why not doing it like this:

<form method="post" action="active_form-sec.php">

Upvotes: 0

Related Questions