PHP - Help With Rn (/r/n) Displaying In Textarea
I have a textarea displaying data from a mysql table. However, a user discovered today that if they use a carriage return in the textarea, the data comes out with "rn" at the location in the text where the carriage return goes. I have been searching the forums for a while this afternoon and have found quite a few references to this, but have been unable to fix my problem.
I am using mysql_real_escape_string before inserting into database (I am not using anything else at insertion time). Is there something else that I should be using at either the insertion into the database or when I display the data? I have tried various combinations of htmlspecialchars() and htmlentities() and nl2br() with no luck. Here is a sample of the output in my textarea: Quote copy diagonal lines and a square with no more than 1/4" overlap or gap at point of closure(modified).rn2.Patient will draw a person ........ Should look like: Quote copy diagonal lines and a square with no more than 1/4" overlap or gap at point of closure(modified). 2.Patient will draw a person ........ Thanks for the help. Matt Similar TutorialsHi All, New to PHP so any help appreciated
Can anyone explain why this;
<tr><td><label for="notes">Notes:</label> Displays data from a MySQL database (field $notes, VARCHAR(250) ) and this;
<tr><td class=textboxlabel><label for="notes">Notes:</label> displays nothing????
Not sure how much info to provide........ Edited November 20, 2019 by cyberRobotAdded a more meaningful post title When I add some text to the front end of the textarea it displays Code: [Select] bla <br/> bla <br/> bla <br/> How can I stop it from showing the html tags? Thanks. echo'<textarea id="info" style="width:80%; height:60px;">'; } echo $profile['info']; if($_SESSION['user_id'] == $id) { echo'</textarea><input type="submit" style="width:70%" value="send" onclick="updateInterests(document.getElementById(\'info\').value)" />'; Hi I have a text area, that I want to display info pulled from a database. I can get the data to show, But can get each entry of the table to display on it's own line. Example: ob1ob2ob3ob4ob5 Should be: ob1 ob2 ob3 ob4 ob5 CODE: Code: [Select] <textarea id="interest" onfocus="clearInterest()" class="textareacss" style="height:212px;overflow:auto;"><?PHP $newInterestSub = Admin_interests_sub::find_by_cat_id($id); foreach($newInterestSub as $newInterestSubs){ echo $newInterestSubs->interest_sub.'\n'; } ?></textarea> Any help would be great. I have a form that generates html code, and displays it in a textarea with submit button. I want to submit button to take the data entered in that textarea1 on page 1, and upload to textarea2 on page 2 How can I do this? I have no idea where to start. hey guys i need to refresh on blur to get to post the upc code inserted in the textarea for product search..
i got the but i can't find the way to post the item
<script> function reload() { window.location.assign("http://store.radioauto.ca/POS/auto.php?Item=upc code here") } </script> <input type="text" id="upc" name="upc" onblur="reload()" value="<?=$_GET['item']?>"/> Please help refresh my memory... It seems to me that there is some combination with nl2br that is a no-no... I am thinking I need to remove nl2br in this code... <textarea id="comments" name="comments" cols="50" rows="15"><?php if (isset($comments)){echo nl2br(htmlentities($comments, ENT_QUOTES));} ?></textarea> Debbie i have a textarea and the content is description. how do i save this to database, because sometimes it has ' and " so it fails when i insert it into database, what should i use addslashes? I'm trying to add a textarea box at the bottom of this form so I can type in note or comments. The issue I'm running into is, the textarea box does not cover the full width of the form...can someone take a look at this code & help me out? I've also attached a .jpg of what I'm seeing in the browser. Thanks Code: [Select] <td> <textarea name="comments" cols"100" rows="5"> </textarea><br> </td> I have a php form which shows all comments of the webpage stored in the database. When i click on the edit button the corresponding 'comments' datas should appear in the textarea. how can i do this, pasting my piece of code $query="select *from comments order by id desc"; $result=mysql_query($query); echo "<table width='700' align='center' border=1><tr bgcolor='green' align='center'><td><font color='black'> SlNo </font></td><td><font color='black'>Comment</font></td><td><font color='black'> Date Posted </font></td><td>Edit/Delete</td></tr></b>"; while($row = mysql_fetch_row($result)) { $d=$row['0']; $id=$row['0']; $name=$row['1']; $date_uploaded=$row['2']; echo "<td>$id</td><td>$name</td>". "<td>$date_uploaded</td>". "<td><a href='edit_comments.php?id=$id'>Edit </a></td>". "</tr>"; } echo "</table>"; } if(isset($_GET['id'])) { $id = $_GET['id']; mysql_connect('localhost','root','') or die("Cannot connect to the Host"); mysql_select_db('sample') or die("Cannot connect to the Database !!"); $query = "SELECT comments FROM comments_tble WHERE id = '$id' "; $result = mysql_query($query); $row=mysql_fetch_row($result); echo"<input type='text' col id='edit_comments' value='$row[0]' width='250' height='10' >"; exit; } Hello PHP geniuses, I'm having a bit of trouble here. I've built a WYSIWYG e-mail editor with the help of TinyMCE. I'm using a textarea to pull the innerHTML from the iframe where the actual editor is. The textarea will be hidden in production, but it's shown now for debugging reasons. I have a JS function that grabs the HTML from the iframe and puts it into the textarea, and this works great. The entire HTML gets populated in the textarea. When I go to save the e-mail (using a simple query that posts it and sends it straight to the database). The HTML is truncated in the database field to around ~255 characters. (it varies depending on what I have in there, but it's usually between 252 and 255) I really can't figure out why this would be cutting off like this. I've looked everywhere, I don't know what else to do. I wanted to add that the field is a text field in the database, that was the first and most obvious thing to check. I can confirm that my database holds the full text no problem. I can go into phpMyAdmin and copy+paste infinite amounts of data into the html field and it saves it without an issue. Thank you as always <3 If you need more information to help me, I will provide whatever helps. I hope someone can help me out with this. What I would like to do is import a text file dircetly to a text area. I can't seem to find any examples on this (Yes I did search Google). I know how to upload but I'm not interested in storing files on the server - but rather just importing them directly to a textarea. Can anyone point me in the right direction? I can upload: <form enctype="multipart/form-data" action="uploader.php" method="POST"> <input type="hidden" name="MAX_FILE_SIZE" value="100000" /> Upload: <input name="uploadedfile" type="file" /><br /> <input type="submit" value="Upload File" /> </form> I can read: $myFile = "testFile.txt"; $fh = fopen($myFile, 'w') But I'm not interested in either of these as they are unnecessary steps (or are they?). Is there not a way to simply browse/import a text file directly to a textarea (or anywhere for that matter) without having to actually save the file to the server? Something like this: <form enctype="multipart/form-data" action="uploader.php" method="POST"> <input type="hidden" name="MAX_FILE_SIZE" value="100000" /> Upload: <input name="uploadedfile" type="file" /><br /> <input type="submit" value="Upload File" /> </form> //uploader.php if (isset($_POST['submit'])) { $content = $_POST['"grab the contents of the file"']; echo "<textarea>"; echo $content; echo "</textarea>"; } has just solved it, can be deleted. What's wrong with this code? Code: [Select] <textarea name="description" cols="60" rows="10"><?= $description ?></textarea> The textarea box returns null. I have the pre tags stored in the database like in the following example:
<pre> ... </pre>I am looking to avoid having the code rendered, when querying it into a textarea. Any suggestions? If the html td changes size, the code below should resize the textarea to fit the html td. The code works for old browsers but why is it not working for new browsers?
$(document).ready(function() { $('textarea').parent().resize(function() { var $t = $(this); $t.find('textarea').height($t.height()); }).resize(); }); Hello, iam almost done with my project .. except there is one more thing left which somehow i cant manage to figure it out....... i manged to make a proxy array which rotates proxies randomly on every try..... but i want for my users to be able to add them manually via the textarea... so they put their proxies and as much as they want...... so then i guess explode should be used to fetch the proxies that were added by the user from the textarea and put them in an array like u see down and then with the curl array_rand it randomises them on evry try The real problem is i dnt know how to indetidy the explode cause iam not adding them manually they will be added via textare by users....... so when they add the ips they need to be fetched from the textare. THNX IN ADVACE $proxies = array( '000.000.000.00:000', <----------------- should i keep this ? cause ips will be added from textarea by users ? '000.000.000.00:000', '000.000.000.00:000', '000.000.000.00:000', ); curl_setopt($ch, CURLOPT_PROXY,$proxies[array_rand($proxies)]); <----- AFTER and array is made using exploit this will call it :) <textarea cols='22' class='area' rows='14' name='proxies'>PROXIES</textarea><br><input type='submit' value='Test'><br></p><p align='center' dir='ltr'><b> Edited by madmike3, 20 August 2014 - 05:29 AM. I've spent the past 2 days googling and trying different methods that people have recommended other people try yet still I come up with the same problem. I am new to coding and I am learning the basic functions so all feedback is welcome in aiding my learning endeavor. I am using a form and all of the inputs are submitting to the database other than the text area which comes up blank. I do not get an error when submitting the form I just get a blank value for the text area 'Comments'.
FORM
<form action="contactdb.php" method="post" form="contactdb"/> Hi, This is driving me to distraction. I have been using this code Code: [Select] <?php $mailto = "edwin@btconnect.com"; $subject = "enquiry"; $message = "Values submitted from web site form:"; $header = "From: ".$_POST['email']; foreach ($_POST as $key => $value) { if (!is_array($value)) { $message .= "\n".$key." : ".$value; } else { foreach ($_POST[$key] as $itemvalue) { $message .= "\n".$key." : ".$itemvalue; } } } mail($mailto, $subject, stripslashes($message), $header); ?> very successfully but now I want to receive information from a 'textarea' in a form but it just doesn't get treated as input. The form is here; <form name="enquiry" method="post" action="feedback.php"> <tr> <td align="left">Name:</td> <td align="right"><input type="text" name="name" size="25" value=""></td> </tr> <tr> <td align="left">email:</td> <td align="right"><input type="text" name="email" size="25" value=""></td> </tr> <tr> <td align="left" valign="top">Blurb:</td> <td align="right"><textarea rows="4" cols="19" value=""></textarea></td> </tr> <tr><td colspan="2" align="right"> <input name="submit" type="image" src="report.gif" width="40" height="20" border="0"> </td></tr></form> Can anyone please help? edwind This topic has been moved to JavaScript Help. http://www.phpfreaks.com/forums/index.php?topic=333153.0 |