Dynadot .com transfer sale, only $10.12 with coupon code DYNA12, available while supplies last, ends October 1, 2026.

Textarea to array trouble

Namecheap AuctionsNamecheap Auctions
SpaceshipSpaceship
SpaceshipSpaceship
Watch

yeppers

VIP Member
Impact
109
Hi all,

I'm having trouble converting data from a textarea into an array (Seperating by new lines).

I have tried exploding based on "\r\n" and "\n" with no luck.

Anyone know how to do this properly?

Thanks,
Rhett.

---------- Post added 04-18-2011 at 12:14 AM ---------- Previous post was 04-17-2011 at 11:20 PM ----------

Oops, this has been solved, was a totally different issue i was having, values i was compaing had a tab in front of them i didn't notice :)...

Sorry for the trouble.
 
0
•••
The views expressed on this page by users and staff are their own, not those of NamePros.
GoDaddyGoDaddy
Have to love what you can't plainly see:p

PHP:
<?
if(in_array(array(" ","  ","→","┘","╛","╝"),$my_code)) {
die("[COLOR="Red"]Code is screwed![/COLOR]:eek:");
}
?>
Result:
Code is screwed!D-:

GLAD you got it figured out:kickass:
 
0
•••
Just in case others would like to see the answer to how to do this.

PHP:
<?php
//make the array
$TAarray = explode("\n", strip_tags($_POST['TAData']));

//loop through the array
foreach ($TAarray as $line) {

       $line = htmlspecialchars(trim($line));
       // then do something with each line here. us mysql_real_escape_string() if injecting into mySQL.
}
?>
 
Last edited:
0
•••
CatchedCatched

We're social

Escrow.com
Spaceship
Escrowly
CryptoExchange.com
Domain Recover
Catchy
  • The sidebar remains visible by scrolling at a speed relative to the page’s height.
Back