Re: multiple selects into mysql database
| From: | Joao Prado Maia | Date: | Thu, 24 Aug 2000 19:05:25 +0000 |
| Subject: | Re: multiple selects into mysql database | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-13503@lists.php.net to get a copy of this message | ||
At 02:58 PM 8/24/2000 -0400, dbarber wrote:
Joao, The contents of the include are inthe original email if you still have it. If not, I'll send again. $discipline does equal Array when in the insert statement, but so does $discipline[$z] !! It does not look like $z is incrementing correctly ? DanHi Dan, Sorry I found the include file as you mentioned. Well, here is the problem : <? $disciplineOption = array("C/C++", "CORBA"); // do work for($i=0; $i < count($disciplineOption); $i++) {
print("<option value=\"$disciplineOption\" ");
print(">{$disciplineOption[$i]}\n");
}
?>
I guess your include file looks like this, after I asked you to change the weird extra braces. Anyway, the problem is that the value of each <option> tag is "Array", since you are not passing any subscripts to the array variable. Try this code :
<?
$disciplineOption = array("C/C++", "CORBA");
// do work
for($i=0; $i < count($disciplineOption); $i++)
echo "<option value='$disciplineOption[$i]'>{$disciplineOption[$i]}</option>\n";
?>
That should work, and do the same as you wanted to do with your two liner for loop :)
Regards,
Joao
--
Joao Prado Maia
Web Developer
Kefta.com, Inc