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.
Setting a PHP variable on button click
Moderator: General Moderators
this is a script that SUBMITS information to a script that processes the information, right?
why not just add a <input type="hidden" name="hide" id="hide" value="1" /> to the form?
then when it's called again it will work.
just check for it with
why not just add a <input type="hidden" name="hide" id="hide" value="1" /> to the form?
then when it's called again it will work.
just check for it with
Code: Select all
/* some stuf */
if($hide){
/* what to do if set */
}else{
/* what to do if not set */
}
/* more stuff */