We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 27449
    • 211 Posts
    Hello all,

    I’m with a big problem!!!!
    I have a search webform and when I submit the button I go for another page that show will show the result for some pages, but when I click on the number on pages I lost the values of the variables...

    I try to save the variable in the cookie but doesn’t work!!!!

    Please can you help me?


    I create a snippet with this code:

    setcookie("property", $_POST[’property’], time()+3600);
    setcookie("country", $_POST[’country’], time()+3600);
    setcookie("property_status", $_POST[’property_status’], time()+3600);

    $doc_inicial = new DOMDocument();
    $doc_inicial->load( ’http://imoveisPaginados.xml?NAT=’.$_COOKIE[’property’].’&CTR=’.$_COOKIE[’country’].’&STT=’.$_COOKIE[’property_status’].’ ’ );


    //PAGINAÇÃO

    $xpag = new DOMXPath($doc_inicial);
    $paginas = $xpag->query(’//recordset[@name="navigation"]/record[@id="pages"]’);

    foreach ($paginas as $pag) {
    $total = $pag->textContent;
    }


    if ($total > 1){

    echo ’<div id="pagination"><ul>’;

    for ($i=1;$i<=$total;$i++){
    if ($page == $i)
    //se mostro o índice da página actual, não coloco link
    echo ’<li>’.$page .’</li>’;
    else
    //se o índice não corresponde com a página mostrada actualmente, coloco o link para ir a essa página
    echo ’<li><a href="[~2~]?NAT=’.$_COOKIE[’property’].’&CTR=’.$_COOKIE[’country’].’&STT=’.$_COOKIE[’property_status’].’&page=’.$i.’">’.$i.’</a><li>’;
    }
    echo ’</ul></div>’;

    }


    echo "COOKIE".$_COOKIE[’property’];