Setting a PHP variable on button click
Posted: Wed Jan 28, 2004 7:03 am
Hi,
I would like to find out if there is a way to set a PHP variable when a submit button is clicked. I need a variable set to true so that after the button is clicked the page is reopened and the header/footer of web page will not be displayed. This is how i've tried to do it:
the buttons code:
<input class ="noprint" type="image" src="images/print.png" name="Print" onClick="<?php $hide = "hello"; ?>; document.form.action='home.php';">
The handle header code:
if (!isset ($hide))
include_once ('./csadminheader.html');
}
So if the button has been clicked hide will be true and the header will not be included if button hasn't been clicked then the header will still be shown.
However i cannot get this to work and have tried different combinations. Any input would be appreciated. Thanks.
I would like to find out if there is a way to set a PHP variable when a submit button is clicked. I need a variable set to true so that after the button is clicked the page is reopened and the header/footer of web page will not be displayed. This is how i've tried to do it:
the buttons code:
<input class ="noprint" type="image" src="images/print.png" name="Print" onClick="<?php $hide = "hello"; ?>; document.form.action='home.php';">
The handle header code:
if (!isset ($hide))
include_once ('./csadminheader.html');
}
So if the button has been clicked hide will be true and the header will not be included if button hasn't been clicked then the header will still be shown.
However i cannot get this to work and have tried different combinations. Any input would be appreciated. Thanks.