title: html form button run command php exec
body: <p>I'm trying to learn how to change some debian system settings using html and php.  I have a few bash scripts that do things for me and I want to do them through a web app.</p>
  
  <p>Right now I'm trying to figure out how to change the SSID name in a file called /etc/hostapd/hostapd.conf.</p>
  
  <p>Change SSID Name: _____Enter New SSID_____ [Button]</p>
  
  <p>Once someone typed in the new SSID name and hit the button then I would have php exec a bash script or just a SED command to replace the text in the /etc/hostapd/hostapd.conf and then display if it was successful or not.  I'm assuming I would use functions and if/then/else.  I've made some decent bash scripts to automate certain things and want to dive into web.  I know and understand HTML really well, and PHP doesn't seem too hard to figure out.</p>
  
  <p>How can I accomplish something like this?</p>
  
  <p>I've tried making a button without user input, but can't get that to work so haven't tried a text box yet.  Assuming permissions and found something about adding Nginx or www-data to sudo.</p>
  
  <pre><code>&lt;?php if (isset($_POST['button'])) { exec('echo Hello World'); } ?&gt;
  &lt;form action="" method="post"&gt;
  &lt;button type="submit" name="button"&gt;Run&lt;/button&gt;
  &lt;/form&gt;
  </code></pre>
  
  <p>(I modified this code from another post I found, but isn't displaying Hello World on the page.)</p>