how to test if form is post or get?
how will i do this? i have the code:
public function executeListmatches(sfWebRequest $request)
{
$form_values = $request->getParameter('match_form', array());
if (isset($HTTP_P开发者_JAVA技巧OST_VARS))
{
$gender_id = $form_values['gender_id2'];
$age1 = $form_values['age1'];
$age2 = $form_values['age2'];
$province_id = $form_values['id'];
}
else
{
echo $gender_id = $request->getParameter('gender2');
echo $age1 = $request->getParameter('age1');
echo $age2 = $request->getParameter('age2');
echo $province_id = $request->getParameter('id');
}
$this->pager = $this->setupPager($gender_id,$age1,$age2,$province_id);
return sfView::SUCCESS;
}
but the line if (isset($HTTP_POST_VARS)) is not correct thank you
You can check the method with sfWebRequest::isMethod($name);
.
So use: if ($request->isMethod('POST'))
.
HTTP_POST_VARS & HTTP_GET_VARS are both deprecated. Your first condition is usisng POST data
精彩评论