hello, i have {$desc} in my website file, example it gives a discriotion like: Monday Night Conversation is our candid conversation with stars of the big and small screen, athletes, entertainers, politicians and other icons. In this episode, BlackTree TV Executive Producer, Ja... Code (markup): but this is too long, so i want the discrioption in a form (text area) so i want put {$desc} into: <form name="form1" method="post" action=""> <label> <textarea name="textarea" cols="30" rows="10"></textarea> </label> </form> Code (markup): how can i do this? i did it like: <textarea name="textarea" cols="30" rows="2">{$desc} </textarea> Code (markup): but then as discription it givies: Monday Night Conversation is our candid conversation with stars of the big and small screen, athletes, entertainers, politicians and other icons.<br></br><br></br>In this episode, BlackTree TV Executive Producer, Ja... Code (markup): what are those <br></br><br></br>? can someone please fix this thnx
You echo a PHP variable like this: <? echo $desc; ?> PHP: <br> is a line break. It brings you to the next line.
$desc = str_replace('<br/>',"\n",$desc); PHP: Place that code somewhere in the code (it looks like you are using template). <br/> is a newline character, which is the same as \n in textarea. Peace,
hello, i made it like: <form name="form1" method="post" action=""> <label> <textarea name="textarea" cols="30" rows="10">$desc = str_replace('<br/>',"\n",$desc);</textarea> </label> </form> Code (markup): so i have put $desc = str_replace('<br/>',"\n",$desc); PHP: into: <form name="form1" method="post" action=""> <label> <textarea name="textarea" cols="30" rows="10"></textarea> </label> </form> PHP: but then in the text area it gives not the discription but: $desc = str_replace('<br/>',"\n",$desc); Code (markup): can someone please give me the correct code, please
I already told you the answer. You are using template system. So the code I gave you will go on a php file. Peace,
@azizny you haven't told the correct answer. you gave $desc = str_replace('<br/>',"\n",$desc); but nevret2 says 'what are those <br></br><br></br>?' the code you gave just replace '<br/>' tags not <br> or </br>. anyway.. @nevret2 maybe your problem could be something like that while the description data is being inserted into datababe, the htmlspecialchars function could translate the data into safe one. use <textarea name="textarea" cols="30" rows="10">htmlspecialchars_decode($desc)</textarea> maybe that could be the solution.. let me know if it works.
It's probably not in a PHP file, and he isn't initiating PHP by using <?php ?> You should definately not be asking questions until you understand the basics. He is treating it like HTML. Tutorials will do much better for you right now. Also, what he wants to do isn't even clear. Echo a variable? Replace line breaks? Both? Does he want pre-determined text in a form? Why? He could just physically put it there if it isn't going to change. Does he want that form to control $desc for later use? This Thread Is Worthless.