Hello to all!
I have to send values from a combobox(listbox) to the query string and than retrive them back to another page,the problem along with this is that I dont know how many values will come from that combobox(listbox) into the query string as these values from this listbox comes from another place which the user select on choice,looking forward to help me out. Thanks
Value of Comboboxlistbox) to query string
Moderator: General Moderators
- feyd
- Neighborhood Spidermoddy
- Posts: 31559
- Joined: Mon Mar 29, 2004 3:24 pm
- Location: Bothell, Washington, USA
If you have control over this combo-box, name it similar to the following: someName[]. (Without the period.) The important part to understand is the brackets. The tell php to create an array. You can get fancy and make the go to specific elements like so: someName[foo].
If you do not have control over it, this may be of interest.
If you do not have control over it, this may be of interest.
Things not working,more help required (ListBox Problem)
feyd | Please use
feyd | Please use
Code: Select all
,Code: Select all
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]
It doesent Works,I tell you the whole story,I have two listboxes at one page,from one listbox things have to be transferred to second listbox,then this second listbox items are sent to next page through query string,now these two listboxes have four buttons among them one of ">" sign to send one item from listbox1 to listbox2,second of "<" to send that item back from listbox2 to listbox1,third is ">>" to send all items from one to two,fourth is "<<" to send all items back to one.Below is the whole code I am giving you,as javascript is involved in the code it doesnt recognizes [] as an array,try to solve it out for me please,thanks.Code: Select all
<script language="JavaScript">
function deleteOption(object,index)
{
object.options[index] = null;
}
function addOption(object,text,value)
{
var defaultSelected = true;
var selected = true;
var optionName = new Option(text, value, defaultSelected, selected)
object.options[object.length] = optionName;
}
function copySelected(fromObject,toObject)
{
for (var i=0, l=fromObject.options.length;i<l;i++)
{
if (fromObject.options[i].selected)
addOption(toObject,fromObject.options[i].text,fromObject.options[i].value);
}
for (var i=fromObject.options.length-1;i>-1;i--)
{
if (fromObject.options[i].selected)
deleteOption(fromObject,i);
}
}
function copyAll(fromObject,toObject)
{
for (var i=0, l=fromObject.options.length;i<l;i++)
{
addOption(toObject,fromObject.options[i].text,fromObject.options[i].value);
}
for (var i=fromObject.options.length-1;i>-1;i--)
{
deleteOption(fromObject,i);
}
}
</script>
<hr color="#000000" SIZE="1">
<form name=form1 >
<table width="101%" border="0">
<tbody>
<tr>
<td width="50%" align="center">
<table border="1" width="99%" height="25">
<tr>
<td width="49%" height="19" align="center"><font face="Verdana"><b>Projects</b></font></td>
<td width="51%" height="19" align="center"><font face="Verdana"><b>Group-Activities</b></font></td>
</tr>
<tr>
<td width="49%" height="1" valign="top">
<p align="left"><font face="Verdana" size="2"><b> </b>
</font>
<p align="left"><font face="Verdana" size="2"><b>
Available
Selected</b>
<table width="312"><tr><td width="98">
<p align="center">
<select name="select1" multiple size="5">
<?
$link = mysql_connect($dbServer, $dbUser, $dbPassword);
if (!$link)
{
die('Could not connect: ' . mysql_error());
}
else
{
mysql_select_db('project');
$result = mysql_query("SELECT projCode FROM defineproject WHERE projStatus = 'active'");
while ($row = mysql_fetch_object($result))
{
?> <option value=<? echo @$row->projCode ?>>
<?
echo "$row->projCode";
}
mysql_free_result($result);
}
mysql_close( $link );
?>
</option>
</select>
</p>
</td><td width="74">
<p align="center">
<input type="button" value=" > " onClick="if (document.images) copySelected(this.form.select1,this.form.select2)">
<p align="center">
<input type="button" value=" < " onClick="if (document.images) copySelected(this.form.select2,this.form.select1)">
<p align="center">
<input type="button" value=">>" onClick="if (document.images) copyAll(this.form.select1,this.form.select2)">
<p align="center">
<input type="button" value="<<" onClick="if (document.images) copyAll(this.form.select2,this.form.select1)">
</td><td width="120">
<p align="center">
<select name="select2" multiple size="5">
</select>
</p>
</td></tr></table>
</font>
</td>
<td width="51%" height="1">
<p align="left"><font face="Verdana" size="2"><b> </b>
</font>
<p align="left"><font face="Verdana" size="2"><b>
Available
Selected</b>
<table width="312"><tr><td width="98">
<p align="center">
<select name="select3" multiple size="5">
<?
$link = mysql_connect($dbServer, $dbUser, $dbPassword);
if (!$link)
{
die('Could not connect: ' . mysql_error());
}
else
{
mysql_select_db('project');
$result = mysql_query("SELECT actCode FROM defineactivity");
while ($row = mysql_fetch_object($result))
{
?>
<option value=<? echo @$row->actCode ?>>
<?
echo "$row->actCode";
}
mysql_free_result($result);
}
mysql_close( $link );
?>
</option>
</select>
</p>
</td><td width="74">
<p align="center">
<input type="button" value=" > " onClick="if (document.images) copySelected(this.form.select3,this.form.select4)">
<p align="center">
<input type="button" value=" < " onClick="if (document.images) copySelected(this.form.select4,this.form.select3)">
<p align="center">
<input type="button" value=">>" onClick="if (document.images) copyAll(this.form.select3,this.form.select4)">
<p align="center">
<input type="button" value="<<" onClick="if (document.images) copyAll(this.form.select4,this.form.select3)">
</td><td width="120">
<p align="center">
<select name="select4" multiple size="5">
</select>
</p>
</td></tr></table>
</font>
<p align="left">
</td>
</tr>
</table>
<table border="1" width="99%" height="156">
<tr>
<td width="100%" height="19">
<p align="center"><font face="Verdana"><b>Employees</b></font></td>
</tr>
<tr>
<td width="100%" height="125" valign="top">
<p align="left"><font face="Verdana" size="2"><b> </b>
</font>
<p align="left"><font face="Verdana" size="2"><b>
Available
Selected</b>
<table width="689"><tr><td width="318">
<p align="center">
<select name="select5" multiple size="5">
<?
$link = mysql_connect($dbServer, $dbUser, $dbPassword);
if (!$link)
{
die('Could not connect: ' . mysql_error());
}
else
{
mysql_select_db('project');
$result = mysql_query("SELECT empId FROM empAccount WHERE activeStatus = 'active'");
while ($row = mysql_fetch_object($result))
{
?>
<option value=<? echo @$row->empId ?>>
<?
echo "$row->empId";
}
mysql_free_result($result);
}
mysql_close( $link );
?>
</option>
</select>
</p>
</td><td width="357" valign="top">
<p align="center">
<input type="button" value=" > " onClick="if (document.images) copySelected(this.form.select5,this.form.select6)">
<input type="button" value=" < " onClick="if (document.images) copySelected(this.form.select6,this.form.select5)">
<p align="center">
<input type="button" value=">>" onClick="if (document.images) copyAll(this.form.select5,this.form.select6)">
<input type="button" value="<<" onClick="if (document.images) copyAll(this.form.select6,this.form.select5)">
</td><td width="318">
<p align="center">
<select name="select6" multiple size="5">
</select>
</p>
</td></tr></table>feyd | Please use
Code: Select all
,Code: Select all
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]pass value of combobox to query string
No one giving in a reply...............I have searched alot to pass value of combobox to query string but no use.........please help