sandy1028 Posted July 18, 2007 Share Posted July 18, 2007 Hello, How to search the string after explode $name=$_POST['name'] $lines= file(data.txt); foreach ($lines as $line) { $text_line = explode(":" , $line); } Search the name in $text_line[0] whether the name is present or not Quote Link to comment Share on other sites More sharing options...
cooldude832 Posted July 18, 2007 Share Posted July 18, 2007 please use the [ code ] brackets, anyway <?php $name=$_POST['name'] $lines= file(data.txt); foreach ($lines as $line) { $text_line[] = explode(":" , $line); } foreach($text_line as $value){ if(strchr($value,$name){ $match[] = $value; } print_r($match); Quote Link to comment Share on other sites More sharing options...
clearstatcache Posted July 18, 2007 Share Posted July 18, 2007 try ds 1... <?php $name=$_POST['name'] $lines= file(data.txt); foreach ($lines as $line) { $text_line = explode(":" , $line); if ( strchr($text_line[0] , $name) ) $match[] = $name; } print_r($match); Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.