How to Ignore query string in a URL?

450 views Asked by At

Hello I have something like this:

if(isset($_POST['btnProm'])){
    $idads = mysql_real_escape_string($_POST['idAds']);
    require_once("adPromFrm.php");  
}

When a button is pressed, a form will appear....

When i refresh the page, the form doesn't disappear, but when i click a link with a query string (thisPage.php?lang=fr...), the form disappears.

I know i m asking the form only if the button is pressed, but how can i ignore the query string.

1

There are 1 answers

1
Byron Whitlock On BEST ANSWER

You might consider using sessions for this behavior. Session data is held between requests so clicking links won't cause the form to disappear.

Observe:

<input type=submit name=showForm value="Show Form">
<input type=submit name=hideForm value="Hide Form">
<?
session_start();

if ($_REQUEST['showForm'])
   $_SESSION[showForm] = true;

if ($_REQUEST['hideForm'])
   $_SESSION[showForm] = false;

if ($_SESSION['showForm'])
{
    include("form.php");
}