Note that there are some explanatory texts on larger screens.

plurals
  1. POphp javascript working to show one value in textbox but cant get the multiple
    primarykey
    data
    text
    <p>i have this code below of javascript:</p> <pre><code>&lt;script&gt; function showUser(str) { if (str=="") { document.getElementById("txtHint").innerHTML=""; return; } if (window.XMLHttpRequest) {// code for IE7+, Firefox, Chrome, Opera, Safari xmlhttp=new XMLHttpRequest(); } else {// code for IE6, IE5 xmlhttp=new ActiveXObject("Microsoft.XMLHTTP"); } xmlhttp.onreadystatechange=function() { if (xmlhttp.readyState==4 &amp;&amp; xmlhttp.status==200) { document.getElementById("txtHint").innerHTML=xmlhttp.responseText; } } xmlhttp.open("GET","includes/get_user.php?q="+str,true); xmlhttp.send(); } &lt;/script&gt; </code></pre> <p>and the php sql script is given below:</p> <pre><code>&lt;?php $testQrys = "SELECT * FROM test where status = 1"; $testdbResults = mysql_query($testQrys); ?&gt; &lt;select size='5' width='925' style='width: 925px' name='users' onchange='showUser(this.value)' multiple&gt; &lt;?php while($test = mysql_fetch_array($testdbResults )) { ?&gt; &lt;option class='h4' value='&lt;?php print($test[9]); ?&gt;'&gt; &lt;?php print($test[5]);echo" ( ";print($test[9]);echo" )"; ?&gt; &lt;/option&gt; &lt;?php } ?&gt; &lt;/select&gt; &lt;div id="txtHint"&gt;&lt;/div&gt; </code></pre> <p>and the get_user.php code is:</p> <pre><code>&lt;?php $q=$_GET["q"]; $con = mysqli_connect('localhost','root','','airways'); if (!$con) { die('Could not connect: ' . mysqli_error($con)); } mysqli_select_db($con,"ajax_demo"); $sql="SELECT * FROM test WHERE m_email = '".$q."'"; $result = mysqli_query($con,$sql); while($row = mysqli_fetch_array($result)) { echo "&lt;input type='text' name='staff_no[]' value='".$row['m_staff_no']."'&gt;"; } mysqli_close($con); ?&gt; </code></pre> <p>now what i want is when i select one user in the select option it shows the staff no of that user but when i select multiple users it does not show the staff no of other users i select.</p> <p>please help me with the change in code so i can get the staff no of users like (22344, 44333, 33344, 55443, 11125, 25263) in the text box</p> <p>waiting for the kind and prompt responses.</p> <p>Thanks in advance</p>
    singulars
    1. This table or related slice is empty.
    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.
 

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