Hi guys I am trying to post values which is getting number from another text box for MySQL select query but i am stuck can u please help me here is my code when I try to get result I cannot add comma(,) between values. also tried implode() and explode() function but the result only got number of array element please help me. I will be glad to try your ideas thanks.
on my sql query i get only row as a result which is my first select
thanks a lot for your help again guys
function exportselectionlist(){
var qcolumns=document.getElementById('selectionlist');
for (i=0; i < qcolumns.length; i++) {
qcolumns.options[i].selected = true;
}
document.selectionlist_form.submit();
}
<form id="selectionlist_form" action="xxx.php" method="post"
name="selectionlist_form">
<select id="selectionlist" style="width:300px;" multiple="multiple" size="4"
name="selectionlist[]">
<option value=""></option>
<option value=""></option>
<option value=""></option>
<option value=""></option>
</select>
<input type="submit" value="x" />
<a onclick="exportselectionlist()" href="javascript:;">Export</a>
</form>
//xxx.php
<?php foreach ($selectionlist as $value) {
$resultstr = array();
foreach ($selectionlist as $result)
$resultstr[] = $result;
echo $x=implode(",",$resultstr);
sql = mysql_query("SELECT * FROM table where idArticle in ('$x')");
Try changing your js function to:
and then your “xxx.php” to:
As a side note, your php code indicates to me that you have register_globals turned on? I would recommend turning that off in favor of creating the variable you need from the $_POST superglobal.