Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

html button to call php shell_exec command

Tags:

html

shell

php

I have google the heck out of this an I cannot get an answer to this. I hate php, but out php guy is too busy and I need HELP!

I want to call a perl script from an html button. But, I just want it to run in the back ground, I don't need to display anything from it... Would something like this work?

<html>
<body>
    <p>
        <button onclick=<?php exec('test.pl') ?>Run Perl</button>
    </p>
</body>

I would prefer not to use cgi, I want to keep this as simple as possible.

Thanks

like image 427
JonnyCplusplus Avatar asked Mar 01 '26 12:03

JonnyCplusplus


1 Answers

That will not works, you have to create an action for that:

<?php
    if (isset($_POST['button']))
    {
         exec('test.pl');
    }
?>
<html>
<body>
    <form method="post">
    <p>
        <button name="button">Run Perl</button>
    </p>
    </form>
</body>
like image 145
tttony Avatar answered Mar 03 '26 03:03

tttony



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!