Possible Duplicate:
How to put string in array, split by new line?
Is it possible when using the $_REQUEST[''] to only request one row from a text area?
Something like:
<?php
$text = $_REQUEST['originalText'];
?>
<textarea name="firstRow" rows="5" cols="50" wrap="OFF" ><?php
echo $text
?></textarea>
<form action="index.php" method="POST" name="editText">
<input name="submit" value="Edit Text" type="submit"><br>
<textarea name="originalText" rows="5" cols="50" wrap="OFF"></textarea>
</form>
Instead of echo $text is it possible to echo just the first row of $text?
I don’t understand exactly what you mean by first row, but if you want to get the first line (before an “enter”) do the following:
Or alternatively (and preferably):
See
strtrDocs and Demo – you might want to add a"\n"to the$textto ensure at least one line exists.