开发者

$_POST value disappears when switching page

I have a very frustrating problem: The $_POST values disappears when using "pagination", I've tried with $_SESSION, which basicly gave me the same result as $_POST.

I tried using setcookies() which worked except I had to refresh the page one time.

global $wp_query;
global $wpdb; 
global $post;  

$restriction1 = 'pool';  
$restriction2 = 'garage';  
$restriction3 = 'tomttradgard';  
$restriction4 = 'enplanmarkplan';  
$restriction5 = 'hiss';  $restriction11 = 'flertoaletter';   
$restrict开发者_如何学Pythonion12 = '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 = '%';}


If you place the following at the top of all your pages, you should be able to use $_SESSION

session_start();

$_POST is only transmitted from a form once, you cannot pass these values on without using session or another mechanism.

Page 1

<?php
 session_start();
 $_SESSION['myvar'] = "123";
?>

Page 2

<?php
 session_start();
 echo $_SESSION['myvar']; //outputs 123
?>
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜