/    Sign up×
Community /Pin to ProfileBookmark

help w/ textarea

Hello to all,

I want to put the word/s inputed in textarea by rows and distribute it in an array. I have textarea with a name Query.

for example user inputed this words

[B]test drive
preview post
please help
thank you[/B]

I want the row 1(test drive) to save in variable $q1[0] and so on….

please help me… Below is my code

[B]<?php
$Query = $_POST[‘Query’];
$j=5;
$len = strlen($Query);
$ctr=0;
$sctr=0;
$pos=0;
$start=0;
$qctr=0;

$last=strrpos($Query, “n”);
$lmt=substr($Query, $last, $len);
while($lmt!=$test)
{
$test=substr($Query, $start, $sctr);
$pos=strpos($test, “n”);
if($pos === FALSE)
{
//echo ‘”n” not found in string’;
$sctr++;
}
else
{
$q1[$qctr]=substr($Query, $start, $pos);
$start=$pos;
$sctr=0;
$qctr++;
}
}
for($k=0;$k<=$qctr;$k++);
{
echo $q1[$k];
}
?> [/B]

to post a comment
PHP

1 Comments(s)

Copy linkTweet thisAlerts:
@temp_user123Jul 09.2007 — [code=php]$query_array = explode("n", $_POST['Query']);[/code]
×

Success!

Help @myanavrin spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 6.1,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @meenaratha,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,

tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,
)...