CodeCharge Studio
search Register Login  

Web Reporting

Visually create Web Reports in PHP, ASP, .NET, Java, Perl and ColdFusion.
CodeCharge.com

YesSoftware Forums -> Archive -> GotoCode Archive

 php help urgent

Print topic Send  topic

Author Message
nat
Posted: 08/29/2002, 12:11 AM

i am writing php code. i have 5 listboxes in first page as coded below:

for ($i=0;$i<$5;$i++)
{
$con=mysql_connect($hostname,$username,$password);
mysql_select_db($dbname,$con);
$selection="select * from subject order by 1";
$result=mysql_query($selection,$con);

echo "<font color=red>","No. ",$i+1," ","</font>";
echo "<SELECT NAME = \"$c_sub\ . $i" multiple>\n";
while($rs=mysql_fetch_array($result))
{
echo "<option value=\"$rs[sub_code]\">$rs[sub_name]</option>";
}
echo "</select>","<br>";

}
then i post this form to another page for inserting data in each selection to a database
code in second page is:

for ($i=0;$i<$nor;$i++)
{

$con=mysql_connect($hostname,$username,$password);
mysql_select_db($dbname,$con);
$strSQL = "INSERT INTO table1(sub_code) VALUES ('$c_sub . $i')";

mysql_query($strSQL,$con);
mysql_close($con);

}
i did select different subject code(values in each listbox) but what it does is it just puts only value in the last listbox into the database.
i think something wrong with <SELECT NAME =.....> and the values i put it in INSERT INTO but i cant figure it out
somebody please help.
would appriciate.
nat
Ricky
Posted: 08/29/2002, 6:00 AM

Nat,
as I see you try to handle multiple values selected from listbox. If so please refer to the following thread
http://www.gotocode.com/disc_viewt.asp?mid=11087
It could help

   


These are Community Forums for users to exchange information.
If you would like to obtain technical product help please visit http://support.yessoftware.com.

MS Access to Web

Convert MS Access to Web.
Join thousands of Web developers who build Web applications with minimal coding.

CodeCharge.com

Home   |    Search   |    Members   |    Register   |    Login


Powered by UltraApps Forum created with CodeCharge Studio
Copyright © 2003-2004 by UltraApps.com  and YesSoftware, Inc.