[Solved] string variable problem
Posted: Thu Feb 02, 2006 12:31 am
feyd | Please use
now, let's say for instance the input sitting in the textarea looks like
after the action is fired, and the php script stips off the times, it SHOULD look like this:
but, alas, it doesn't...i have the script display the text before and after parsing out the times and both of them look like this:
am i missing something obvious? it seems as if the string variable doesn't hold the carriage returns? what can i do to fix this
feyd | Please use
Code: Select all
andCode: Select all
tags where appropriate when posting code. Read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url][/color]
probably a stupid question but i've googled and checked what books i have and the forum and maybe i'm not searching for the right thing but this is the problem i'm having
i'm writing a simple php script that takes input from a textarea form, passes it to a string variable, then i pull out what i don't want of the string using regex. (i know the regex isn't as elegant as it can be, i just tossed it together to get something working).
<form action="strip.php" method="post">
<textarea name="text" cols=70 rows=50></textarea>
--strip.php follows:Code: Select all
<?php
$text_data = $_POST['text'];
print($text_data . "<br><br>");
if (strlen($text_data) > 0)
{
$new_data = eregi_replace("[\[0-9]+[0-9]+:[0-9]+[0-9]+:[0-9]+[0-9]+]\ ","",$text_data);
print($new_data);
}else{
print("Invalid Entry. Try Again.");
}
?>now, let's say for instance the input sitting in the textarea looks like
Code: Select all
[00:00:01] garbage
[00:00:02] in
[00:00:03] garbage
[00:00:04] outCode: Select all
garbage
in
garbage
outCode: Select all
[00:00:01] garbage [00:00:02] in [00:00:03] garbage [00:00:04] out
garbage in garbage outam i missing something obvious? it seems as if the string variable doesn't hold the carriage returns? what can i do to fix this
feyd | Please use
Code: Select all
andCode: Select all
tags where appropriate when posting code. Read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url][/color]