Before starting php echo a message and activate button?

63 Views Asked by At

How do I activate stages of php, for example the user opens the php file. And before starting the script they are asked "are you sure you want to continue". With a button below staying activate.

I have already looked around and I'm sure there is a way to do it but I don't know what it is called. Could someone help me out?

1

There are 1 best solutions below

0
On BEST ANSWER

.Short way to do that:

if($_GET['execute'] == 'yeah') {
    // your php-file-content goes here....
    // ....
} else {
    echo '<a href="'.$_SERVER["PHP_SELF"].'?execute=yeah">Are you sure you want to execute this file?</a>'.PHP_EOL;
}

Just put your filecontent between the IF part. It wont be executed untill the request ist yourfilename.php?execute=yeah