...

View Full Version : read line by line in the textarea



HG3
01-12-2012, 09:54 AM
Hello my brothers, can you guys give me some help here
My script searches the array of numbers in the text and sets the last found.

can not check several at the same time of textarea.


<form id="form1" name="form2" method="post" action="">
<label>
<textarea name="text" cols="60" rows="10"></textarea>
</label>
<input type="submit" name="submit" value="TEST" />
</form>
<?php
if(isset($_POST['text'])&&($_POST['text'] != "")){

$text = explode("\n", $_POST['text']);

for($i=0;$i < count($text);$i++){
$num = $text[$i];
$search = array ('00','01','02','03'); //search numbers in the text
$p = null;
$o = -1;
$l = strlen( $num );

foreach ( $search as $i ) {
$c = strrpos( $num , $i ); //Search by last

if ( $c !== false && $c > $o ) {
$p = $i;
$o = $c;

if ( $c + strlen( $i ) == $l ) {
break;
}
}
}

if ( $o != -1 ) { // last number set no text
$result = $p;
}
}
}
echo $result;
?>

can help verify several at the same time?

HG3
01-12-2012, 01:55 PM
got it solve.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum