Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>You cannot pass variable values from the current page javascript to the current page PHP code... PHP code runs at the server side and it doesn't know anything about what is going on on the client side.</p> <p>You need to pass variables to PHP code from html-form using another mechanism, such as submitting form on GET or POST methods.</p> <pre><code>&lt;DOCTYPE html&gt; &lt;html&gt; &lt;head&gt; &lt;title&gt;My Test Form&lt;/title&gt; &lt;/head&gt; &lt;body&gt; &lt;form method="POST"&gt; &lt;p&gt;Please, choose the salary id to proceed result:&lt;/p&gt; &lt;p&gt; &lt;label for="salarieids"&gt;SalarieID:&lt;/label&gt; &lt;?php $query = "SELECT * FROM salarie"; $result = mysql_query($query); if ($result) : ?&gt; &lt;select id="salarieids" name="salarieid"&gt; &lt;?php while ($row = mysql_fetch_assoc($result)) { echo '&lt;option value="', $row['salaried'], '"&gt;', $row['salaried'], '&lt;/option&gt;'; //between &lt;option&gt;&lt;/option&gt; tags you can output something more human-friendly (like $row['name'], if table "salaried" have one) } ?&gt; &lt;/select&gt; &lt;?php endif ?&gt; &lt;/p&gt; &lt;p&gt; &lt;input type="submit" value="Sumbit my choice"/&gt; &lt;/p&gt; &lt;/form&gt; &lt;?php if isset($_POST['salaried']) : ?&gt; &lt;?php $query = "SELECT * FROM salarie WHERE salarieid = " . $_POST['salarieid']; $result = mysql_query($query); if ($result) : ?&gt; &lt;table&gt; &lt;?php while ($row = mysql_fetch_assoc($result)) { echo '&lt;tr&gt;'; echo '&lt;td&gt;', $row['salaried'], '&lt;/td&gt;&lt;td&gt;', $row['bla-bla-bla'], '&lt;/td&gt;' ...; // and others echo '&lt;/tr&gt;'; } ?&gt; &lt;/table&gt; &lt;?php endif?&gt; &lt;?php endif ?&gt; &lt;/body&gt; &lt;/html&gt; </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload