Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>you have to use client side scripting to retrieve what users choose.</p> <p>You can use <a href="http://jquery.com/" rel="nofollow">jQuery</a>:</p> <pre><code>&lt;html&gt; &lt;head&gt; &lt;script type="text/javascript" src="jquery.js"&gt;&lt;/script&gt; &lt;script type="text/javascript"&gt; $(document).ready(function(){ $('#write_in_div').click(function(){ var name = $('#names').val(); var surname = $('#surnames').val(); var email = $('#emails').val(); $('#write_in_div').text("Name: "+name+" - Surname: "+surname+" - Email: "+email); }); }); &lt;/script&gt; &lt;/head&gt; &lt;body&gt; &lt;?php require 'content.php';?&gt; &lt;/body&gt; &lt;/html&gt; </code></pre> <p>with <code>content.php</code>:</p> <pre><code>&lt;?php $resource_names = mysql_query("SELECT DISTINCT NAME FROM selections ORDER BY id ASC"); $names = array(); while($row = mysql_fetch_row($resource_names)){ $names[] = $row[0] } $resource_surnames = mysql_query("SELECT DISTINCT SURNAME FROM selections ORDER BY id ASC"); $surnames = array(); while($row = mysql_fetch_row($resource_surnames)){ $surnames[] = $row[0]; } $resource_emails = mysql_query("SELECT DISTINCT EMAIL FROM selections ORDER BY id ASC"); $emails = array(); while($row = mysql_fetch_row($resource_emails)){ $emails[] = $row[0]; } if(count($emails) &lt;= 0 || count($surnames) &lt;= 0 || count($emails) &lt;= 0){ echo 'No results have been found.'; } else { // Display form echo '&lt;form name="form" method="post" action="test.php"&gt;'; //Names dropdown: echo '&lt;select name="id" id="names"&gt;'; foreach($names as $name) echo "&lt;option id='$name'&gt;$name&lt;/option&gt;"; echo '&lt;/select&gt;'; //Surnames dropdown echo '&lt;select name="id" id="surnames"&gt;'; foreach($surnames as $surname) echo "&lt;option id='$surname'&gt;$surname&lt;/option&gt;"; echo '&lt;/select&gt;'; //Emails dropdown echo '&lt;select name="id" id="emails"&gt;'; foreach($emails as $email) echo "&lt;option id='$email'&gt;$email&lt;/option&gt;"; echo '&lt;/select&gt;'; echo "&lt;button id='write_in_div'&gt;Click me!&lt;/button&gt;"; echo '&lt;/form&gt;'; } ?&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