Jump to content

Rokit

New Members
  • Posts

    4
  • Joined

  • Last visited

    Never

Everything posted by Rokit

  1. By God it worked. Seems no matter what programming language I've always been able to use ' and " interchangeably. Thanks for the help.
  2. First, here's some code: $result = mysql_query("SELECT standard FROM thestandards WHERE id={$theSearch}", $connection); if (!$result) { die("Database connection failed: " . mysql_error()); } while ($row = mysql_fetch_array($result)) { $query = $row[0]; } // echo $testing = nl2br($query); $subStrings = explode('\n', $query); echo $subStrings[0] . "<br />"; // outputs entire query echo $subStrings[1] . "<br />"; // undefined offset echo $subStrings[2] . "<br />"; // undefined offset echo $subStrings[3] . "<br />"; // undefined offset So, the data I'm retrieving from the database is several small paragraphs. I want to take these paragraphs, separate them, and put them into an array. I tried using the explode function with the newline char, but for some reason it doesn't work. I can get it to work if I want to go explicitly add "\n"s in the database everywhere, but that just doesn't seem practical. nl2br doesn't work for what I need, but I find it interesting that this function is somehow able to "see" all the newlines in the query, whereas the explode function cannot. Explode is really what I need, but I've tried '\n', '\r', '\r\n' and nothing works. Thanks for the help.
  3. Oh ok, so it has to be submitted. Yeah, I thought of that right after I posted, litebearer. It would probably be better just getting the info straight from the database, then I can just format it and put it into the text area. Thanks anyway guys.
  4. I'm trying to retrieve the text from a text area and put this in a PHP variable without submitting the form. The text is provided by a database and I want to format it for the user. How can I do this with PHP? So basically: <form id="createForm" name="createForm" method="post" action=""> <textarea name="subjectTextArea" id="subjectTextArea" cols="45" rows="5"> This is the text I want to put in a PHP variable before the form is submitted. </textarea> </form> <?php $txtArea = ? ?> Thanks for the help.
×
×
  • 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.