Posted by FayeC on 11/29/05 18:37
I have the following code:
<?php
$username = $_POST['username'];
$myFile = "clientlist.txt";
$fp = fopen($myFile, 'r');
$content = fread( $fp, filesize( $myFile ) );
$inputString = $username;
$arrFp = file( $myFile ); // Open the data file as an array
$numLines = count( $arrFp ); // Count the elements in the array
$arrWords = explode( ' ', $inputString ); // Split the input string
into words as an array
$numWords = count( $arrWords ); // Count the words in the string
for($i=0; $i<$numWords; $i++) // Loop through the words in the string
{
for($j=0; $j<$numLines; $j++) // Loop through the lines of the
text file
$outputString .= $arrWords[$i].' ';
}
?>
And I need it to read a txt file that has something like:
user1="Smith"
user2="Macintosh"
user3="Hogan"
I need the outputString to be what is between the "" and not the
$username....
Right now it is outputting the same as the $username.
How do I change the code to select what is between the "" in the text
file?
Thank you for any help,
FayeC
[Back to original message]
|