tags:

views:

39

answers:

1

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  A: 

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");
}
Byron Whitlock
Note: Be sure to quote `showForm` inside of $_SESSION...
ircmaxell
Thanks for your help, it's a great idea, the form doesn't disappear now, but the others post variables are null. May be i have to put them in a session also.
jartaud