Jump to content

Detect new line in text area


Exoon

Recommended Posts

Hi,

 

Im trying to make a script to mass update a load of links in my database but im stuck on the basics, How can i detect a new line in a text area?

 

Anyone know why this dosen't work?

 

 

<?php
if($_POST[newlinks]) {
    
    $newlinks = preg_split("\n", ($_POST['newlinks']));
    $i = 1;
    foreach ($newlinks as $newlink) {
      
      echo "$i - $newlink <br />";
      $i++;
   }
  
} else {


  echo "<form method=\"POST\" action=\"changehost.php\">";
  echo "<br /> <strong>Enter the new links to try and replace old ones</strong> <br />";
  echo "<textarea rows=\"16\" name=\"newlinks\" cols=\"84\"></textarea>";
  echo "<input type=\"submit\" value=\"Submit\" name=\"B1\">";


?>

Link to comment
https://forums.phpfreaks.com/topic/251445-detect-new-line-in-text-area/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.