PHP form submits to itself. When clicking on paginating links. All except the Form, vanishes
<p>It is a self-submitting Form. I have 3 independent Select lists whose selected values are passed as the WHERE parameters for the sql query.</p>

<p>When I click on the button, all data are displayed just fine, well LIMITed, and the link pages are below. But:</p>

<p>When I get to click on the page links, the result set and all the links disappear from sight (only the select lists remain in sight). I believe it is related to the isset condition that, if the values have not been set, display the form, if the values have been set, then process the form. So, the first result set displays correctly, but when you try to go to the second page my form interprets that the Select Lists are not set because they are reset and because i have not clicked on the button if i click on the links instead and therefore, it wipes out everything that it not an html Form.</p>

<p>There is no error in the paginating code. The error is in how I link this form with this paginating method. And I can't get to know how I should.</p>

<pre><code>        if (isset($_POST['submitted'])) { /***************IF IT IS SET, WE PROCESS THE VALUES*************************/
        $oldcountry = FALSE;
        $oldfrom = FALSE;
        $oldinto = FALSE;

 // Here just checking that all variables have been selected

       if (isset($_POST['country']))


        {
        $oldcountry = $_POST['country'];
        $country = filter_var($oldcountry, FILTER_SANITIZE_STRING);
        }
        else {
        echo 'Please, select a country';
        }
        if (isset($_POST['from_language']))
        {
        $oldfrom = $_POST['from_language'];
        $from_language = filter_var($oldfrom, FILTER_SANITIZE_STRING);
        }
        else {
        echo 'no has metido el from language';
        }
        if (isset($_POST['into_language']))
        {
        $oldinto = $_POST['into_language'];
        $into_language = filter_var($oldinto, FILTER_SANITIZE_STRING);
        }

    // so, once we have selected them and clicked the button, we go for the query

    // and paginate the results


        require_once('bdd1.php');
        $per_page = 6;
        $pages_query = mysql_query("SELECT COUNT(FName)
        FROM work_assignment, developer
        WHERE AES_DECRYPT(country, 'elperrodesanroquenotienerabo') = '".$country."'
        AND from_language = '".$from_language."'
        AND into_language = '".$into_language."'
        AND work_assignment.developer_id = developer.developer_id
        ORDER BY FName ASC ");
        $pages = ceil (mysql_result($pages_query, 0) /$per_page);
        $page = (isset($_GET['page'])) ? (int)$_GET['page'] : 1;
        $start = ($page - 1) * $per_page;
        $query = mysql_query("SELECT FName
        FROM work_assignment, developer
        WHERE AES_DECRYPT(country, 'elperrodesanroquenotienerabo') = '".$country."'
        AND from_language = '".$from_language."'
        AND into_language = '".$into_language."'
        AND work_assignment.developer_id = developer.developer_id
        ORDER BY FName ASC LIMIT $start, $per_page");
        while ($query_row = mysql_fetch_assoc($query)){
        echo '&lt;p&gt;', $query_row['FName'], '&lt;/p&gt;';
        }
        if ($pages &gt;=1) {
        for($x = 1; $x &lt;=$pages; $x++){
        echo '&lt;a href="?page='.$x. '"&gt;'.$x.'&lt;/a&gt; ';
        }
        }
        } /************* END OF IF ISSET TO PROCESS *******************************/

    ?&gt;
</code></pre>

<p>UPDATE    UPDATE  </p>

<p>After all the help, I managed to write a URL string that makes the page links work. Yet, still I need to tweak it as I hardcoded the name of the country (basically Estonia) instead of embedding the variable that represents it, but I can't make that URL properly be written:</p>

<p>This works:</p>

<pre><code>echo '&lt;a href="?country=Estonia&amp;from_language=Russian&amp;into_language=Latvian&amp;submitted=true&amp;
page='.$x. '"&gt;'.$x.'&lt;/a&gt; ';
</code></pre>

<p>I would just need to replace Estonia by $country, and Russian by $from_language and Latvian by $into_language. But I have tried all possible combinations of single and double quotes and dots and I get syntax errors. Does anybody know how to write that?</p>
