Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>You may try like this</p> <pre><code> &lt;script type="text/javascript"&gt; function mergeval(val,flag) { if(flag==1) document.getElementById('mvalue1').innerHTML = val ; else if(flag==2) document.getElementById('mvalue2').innerHTML = val; else if(flag==3) document.getElementById('mvalue3').innerHTML = val; } &lt;/script&gt; &lt;?php session_start(); $_SESSION['values']=!empty($_SESSION['values']) ? $_SESSION['values']:array(); if(!empty($_REQUEST['selection_id'])&amp;&amp;!empty($_REQUEST['fixture_id'])&amp;&amp;!empty($_REQUEST['name'])) { $_SESSION['values'][] = array('id'=&gt;$_REQUEST['selection_id'],'fid'=&gt;$_REQUEST['fixture_id'],'name'=&gt;$_REQUEST['name']); } $dispval ="&lt;table&gt;"; foreach(@$_SESSION['values'] as $key=&gt;$val) { $dispval .="&lt;tr&gt;&lt;td&gt;".$val['id']."&amp;nbsp;".$val['fid']."&amp;nbsp;".$val['name']."&lt;/td&gt;&lt;/tr&gt;"; } $dispval .="&lt;/table&gt;"; echo $dispval; ?&gt; &lt;?php require "config.php"; //Database connection $resource_selections = mysql_query("SELECT DISTINCT selection_id FROM selections ORDER BY selection_id ASC"); $selections = array(); while($row = mysql_fetch_row($resource_selections)){ $selections[] = $row[0]; } $resource_fixtures = mysql_query("SELECT DISTINCT fixture_id FROM selections ORDER BY selection_id ASC"); $fixtures = array(); while($row = mysql_fetch_row($resource_fixtures)){ $fixtures[] = $row[0]; } $resource_names = mysql_query("SELECT DISTINCT name FROM selections ORDER BY selection_id ASC"); $names = array(); while($row = mysql_fetch_row($resource_names)){ $names[] = $row[0]; } if(count($selections) &lt;= 0 || count($fixtures) &lt;= 0 || count($names) &lt;= 0){ echo 'No results have been found.'; } else { // Display form echo '&lt;form name="form" method="post" action="selection.php"&gt;'; //SelectionID dropdown: echo "&lt;select name='selection_id' id='selections' onchange='javascript:mergeval(this.value,1)'&gt;"; foreach($selections as $selection) echo "&lt;option id='$selection'&gt;$selection&lt;/option&gt;"; echo '&lt;/select&gt;'; //FixtureID dropdown echo "&lt;select name='fixture_id' id='fixtures' onchange='javascript:mergeval(this.value,2)' &gt;"; foreach($fixtures as $fixture) echo "&lt;option id='$fixture'&gt;$fixture&lt;/option&gt;"; echo '&lt;/select&gt;'; //Name dropdown echo "&lt;select name='name' id='names' onchange='javascript:mergeval(this.value,3)'&gt;"; foreach($names as $name) echo "&lt;option id='$name'&gt;$name&lt;/option&gt;"; echo '&lt;/select&gt;'; echo "&lt;input type='submit' name='submit' value='Submit' /&gt;"; echo '&lt;/form&gt;'; } ?&gt; &lt;table&gt; &lt;tr&gt;&lt;td &gt;&amp;nbsp;&lt;span id="mvalue1"&gt;&lt;/span&gt;&amp;nbsp;&lt;span id="mvalue2"&gt;&lt;/span&gt;&amp;nbsp;&lt;span id="mvalue3"&gt;&lt;/span&gt;&lt;/td&gt;&lt;/tr&gt; &lt;/table&gt; </code></pre>
 

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