doushun1904 2012-08-07 17:13
浏览 68
已采纳

我正确使用$ _POST ['var']吗?

So I'm using wordpress, but the wordpress community doesn't seem to know enough about strict PHP or anything to assist in this scenario.

I've got a plugin called Gravity Forms I'm using to create a pretty elaborate form/survey. The deal is though, it's a multi-part form and I'm not sure how to get ALL the form data from the first to the second.

I can pass data via Query String, but I'm passing 25 fields of information, so it's not quite going to work for me.

As soon as the form1 is submitted, can I then have it redirect to page two, which has some code in it like

$foo = $_POST['field_1_1']; 

where field_1_1 is the name of the input from the previous form?

I've used $_GET for query strings before, but I'm not sure if the example I just stated is how to use $_POST

  • 写回答

4条回答 默认 最新

  • dpdp42233 2012-08-07 17:14
    关注

    Yes, this is correct usage. Just make sure your form is submitting using the POST method.

    Just make sure (as you would with $_GET) that user inputs are not to be trusted. Be sure to sanitize them for database interaction.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(3条)

报告相同问题?