Jump to content

$_POST empty on post from different page.


Harmster
 Share

Recommended Posts

Hey,

I've already posted a post about this earlier: 

http://processwire.com/talk/topic/3727-does-input-urlsegments-mess-with-post/

And I've fixed that problem at the time to switch from WAMP to XAMPP server. I didnt know why it worked but you didn't hear me complain.

Now I've uploaded my website to a webhosting service and I once again encounter this problem...

So here's the situation. I try to post a comment from my homepage to a page called /actions/post-comment (this has a template)

This template contains the following code:

<?php
if($_SERVER['REQUEST_METHOD'] == 'POST'){
    echo 'POST HAS BEEN SET';
}else{
    ?>
    <form action="<?php echo $config->urls->root;?>actions/post-comment/" method="post">
        <input type="text" name="harm"/>
        <input type="submit" value="test" />
    </form>
    <?php
}
?>

This was for testing purposes. If I post here it does show POST HAS BEEN SET.

Now this is my form on my homepage (Taken fromt he HTML sourcecode)

<form action="/actions/post-comment" method="post">
<input type="text" placeholder="comment" autocomplete="off" name="comment"/>
</form>

But THIS doesn'r display it. 

I am using PHP5 and standart .htaccess My hosting provider is Go Daddy and I am just stuck on this... I think it has to do something with 

htaccess but I have no idea what and I have no idea where to look.

EDIT:
 

As mentioned in the previous post, i've tried addint a / to the request but no

Please help,

Much appriciated.

Link to comment
Share on other sites

<form action="/actions/post-comment" method="post">

You need a trailing slash, I think Pw does a redirect and you loose the POST request.

Please try this once again and make sure it does still not work.

Edit: To be bullet proof:

<form action="<?php echo $pages->get(ID_OF_PAGE)->url; ?>" method="post">
  • Like 3
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...