I'm loading a series of descriptions and categories from a text file. I then load the descriptions into a drop down list.
It works all fine when I first load the page, but then I submit some information (including the drop down box info) off the page to another PHP file to record the data into a database, and then I call include to get back to my original page. When I do this though my drop down list only shows the first letter from my descriptions.
To read and display the information I use :
[PHP]<?php
$size =0;
$file = fopen("categori es.txt", "r");
//Get categories from categories.txt
while(! feof($file))
{
$category[$size] = fgets($file);
$description[$size]=fgets($file);
$size++;
}
fclose($file);
?>[/PHP]
I then display descriptions in the drop down by doing:
[PHP] <?php
//Display categories from /categories.txt
for ($i=0; $i<$size;$i++)
{
echo"<option value='$categor y[$i]'>$description[$i]</option>" ;
}
?> [/PHP]
any ideas guys?
It works all fine when I first load the page, but then I submit some information (including the drop down box info) off the page to another PHP file to record the data into a database, and then I call include to get back to my original page. When I do this though my drop down list only shows the first letter from my descriptions.
To read and display the information I use :
[PHP]<?php
$size =0;
$file = fopen("categori es.txt", "r");
//Get categories from categories.txt
while(! feof($file))
{
$category[$size] = fgets($file);
$description[$size]=fgets($file);
$size++;
}
fclose($file);
?>[/PHP]
I then display descriptions in the drop down by doing:
[PHP] <?php
//Display categories from /categories.txt
for ($i=0; $i<$size;$i++)
{
echo"<option value='$categor y[$i]'>$description[$i]</option>" ;
}
?> [/PHP]
any ideas guys?
Comment