title: Passing variable from PHP button to python script
body: <p>I've create PHP script that takes in user input and sends it to a Python script. The Python script creates an image which the PHP script displays.</p>
  <p>Here's my Python code:</p>
  <pre class="lang-py prettyprint-override"><code>import sys
  import matplotlib.pyplot as plt
  import numpy as np
  import ftplib
  
  result = sys.argv[1]
  
  x = np.arange(0, result, 0.1)
  y = np.sin(x)
  
  plt.plot(x, y)
  plt.savefig('image.png')
  
  </code></pre>
  <p>My PHP code:</p>
  <pre class="lang-php prettyprint-override"><code>&lt;!DOCTYPE html&gt;
  &lt;html lang=&quot;en&quot;&gt;
  &lt;head&gt;
      &lt;title&gt;Contact Form&lt;/title&gt;
  &lt;/head&gt;
  &lt;body&gt;
      &lt;h2&gt;Value identifier&lt;/h2&gt;
      &lt;p&gt;Please fill in the value:&lt;/p&gt;
      &lt;form action=&quot;&quot; method=&quot;post&quot;&gt;
          &lt;p&gt;
              &lt;label for=&quot;inputName&quot;&gt;Name:&lt;/label&gt;
              &lt;input type=&quot;text&quot; name=&quot;value&quot; id=&quot;inputName&quot;&gt;
          &lt;/p&gt;
          &lt;input type=&quot;submit&quot; name=&quot;submit&quot; value=&quot;Submit&quot;&gt;
      &lt;/form&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  
  
  &lt;?php
      error_reporting(E_ALL); 
      ini_set('display_errors', 1);
  
      $values=$_POST['value'];
      $rad=exec(&quot;python test.py&quot;.$values);
      echo $values;
      echo $rad;
      echo &quot;&lt;img src='image.png'&gt;&quot;;
  
  
  ?&gt;
  </code></pre>
  <p>I don't get anything published, as if the Python script isn't even running. But printing the values I want to pass is successful.</p>