【发布时间】:2012-12-19 02:51:20
【问题描述】:
我有一个非常令人沮丧的问题:使用“分页”时$_POST 的值消失了,我尝试使用$_SESSION,这基本上给了我与$_POST 相同的结果。
我尝试使用setcookies(),但我必须刷新一次页面。
global $wp_query;
global $wpdb;
global $post;
$restriction1 = 'pool';
$restriction2 = 'garage';
$restriction3 = 'tomttradgard';
$restriction4 = 'enplanmarkplan';
$restriction5 = 'hiss'; $restriction11 = 'flertoaletter';
$restriction12 = 'havsutsikt';
$restriction13 = 'takterass';
$restriction6 = 'sovrum';
$restriction7 = 'pris';
$restriction8 = 'omrade';
$restriction9 = 'area';
$restriction10 = 'hustyp';
if ($_POST["poolsb"]) { $value1 = $_POST["poolsb"]; }
if ($_POST["garagesb"]) { $value2 = $_POST["garagesb"]; }
if ($_POST["tomttradgardsb"]) { $value3 = $_POST["tomttradgardsb"]; }
if ($_POST["enplanmarkplansb"]) { $value4 = $_POST["enplanmarkplansb"]; }
if ($_POST["hisssb"]) { $value5 = $_POST["hisssb"]; }
if ($_POST["flertoalettersb"]) { $value11 = $_POST["flertoalettersb"]; }
if ($_POST["havsutsiktsb"]) { $value12 = $_POST["havsutsiktsb"]; }
$value13 = $_POST["takterasssb"];
if (!$ppp) { if ($_POST["ppp"]) { $ppp = $_POST['ppp']; } else { $ppp = 10; } }
if (!$value1) { $value1 = '%';} if (!$value2) { $value2 = '%';}
if (!$value3) { $value3 = '%';} if (!$value4) { $value4 = '%';}
if (!$value5) { $value5 = '%';} if (!$value6) { $value6 = '%';}
if (!$value7) { $value7 = '%';} if (!$value8) { $value8 = '%';}
if (!$value9) { $value9 = '%';} if (!$value10) { $value10 = '%';}
【问题讨论】:
-
你应该看看循环和数组。所有这些代码大约有 5 行长。
标签: php mysql wordpress pagination