I use to do this:
$lines=file($filename);
$num_lines=count($lines);
for($i=0;$i<$num_lines;$i++)echo '<option
value="'.$lines[$i].'">'.$lines[$i].'</option>';

-- 
// DvDmanDT
MSN: dvdmandt€hotmail.com
Mail: dvdmandt€telia.com
"Tony" <[EMAIL PROTECTED]> skrev i meddelandet
news:[EMAIL PROTECTED]
> I'm new to php,
> and i tried file() no luck
> $lines = file('$filename');
> foreach ($lines as $line_num => $line) {
> print ("<option value=\"$line\">$line</option>");
>
> }
>
>
>
> thanx for the help
>
>
> "Dvdmandt" <[EMAIL PROTECTED]> wrote in message
> news:[EMAIL PROTECTED]
> > Did you try file(); ?
> >
> > -- 
> > // DvDmanDT
> > MSN: dvdmandt€hotmail.com
> > Mail: dvdmandt€telia.com
> > "Tony" <[EMAIL PROTECTED]> skrev i meddelandet
> > news:[EMAIL PROTECTED]
> > > hi,
> > >
> > > i have problem with writing a reading to file
> > > i want to write emails in files. like this
> > > [EMAIL PROTECTED]
> > > [EMAIL PROTECTED]
> > > [EMAIL PROTECTED]
> > > etc......
> > >
> > > this is how I write to the file
> > >
> > > $handle = fopen($filename, "a");
> > > fwrite($handle,"$email\n",128);
> > > fclose($handle);
> > >
> > >
> > > ok it writes everything just fine but now i want to read the file line
> by
> > > line and print line by line.
> > > this is how i do it.
> > >
> > > <?php
> > >     $handle = fopen ($filename, "r");
> > >
> > >     do {
> > >         $data = fread($handle, 128);
> > >         if (strlen($data) == 0) {
> > >             break;
> > >         }
> > >         print ("$data<br>");
> > >     } while (true);
> > >     fclose($handle);
> > > ?>
> > >
> > >
> > >
> > > the problem i get then is everything is printed in one line.
> > >
> > >
> > >
> > > any help is appreciated.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to