Nandini Posted October 29, 2008 Share Posted October 29, 2008 hi I have a textarea in a form. In that user enters data like fromuser=xxxxxxx fromdomain=xxxxx.xxxxx.xxx canreinvite=no qualify=3000 nat=yes I want to check line by line and print that as it is. I dont know how many lines of data he enter. I have to check each line and print. That textarea value is stored into the database. I know how to display the whole data. here is my script. $rcount=count(explode("\n",$row['peer_details'])); $rdata=explode("\n",$row['peer_details']); $i=0; while($i<=$rcount) { echo rtrim($rdata[$i]); $i++; } Link to comment https://forums.phpfreaks.com/topic/130535-check-by-linewise/ Share on other sites More sharing options...
asmith Posted October 29, 2008 Share Posted October 29, 2008 this parts of your code : $rcount=count(explode("\n",$row['peer_details'])); contains the number of your lines, and your script is right. Link to comment https://forums.phpfreaks.com/topic/130535-check-by-linewise/#findComment-677196 Share on other sites More sharing options...
Nandini Posted October 29, 2008 Author Share Posted October 29, 2008 ya my script is correct till display lines. But i want to check line wise. for example check 1st line if it is corect ot not. same as check second line if it is correct or not. same as 3,4,5 etc How can i do that Link to comment https://forums.phpfreaks.com/topic/130535-check-by-linewise/#findComment-677198 Share on other sites More sharing options...
asmith Posted October 29, 2008 Share Posted October 29, 2008 how you mean correct it? like it checks if first line begins with 'fromuser=' ? Link to comment https://forums.phpfreaks.com/topic/130535-check-by-linewise/#findComment-677199 Share on other sites More sharing options...
Nandini Posted October 29, 2008 Author Share Posted October 29, 2008 Not begins with fromuser= i want to check what first line contains? that means it begins with fromuser= or fromdomain= etc. and same as what second line contains? and third line, till end of the line. Link to comment https://forums.phpfreaks.com/topic/130535-check-by-linewise/#findComment-677604 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.