...

View Full Version : Using lots of inverted commas in Textarea



cevaps
06-27-2010, 08:50 PM
Hello, I'm newbie. I couldn't make this tiny code work.


<?php

$caps=$_POST["caps"];
$aciklama=$_POST["aciklama"];
$linkler=$_POST["linkler"];
$tur=$_POST["tur"];


echo '<table border="1" width="100%" id="table1" height="638">
<tr>
<td width="590">
<p align="center"><font size="5"><b>F1</b></font></p>
<p align="center">
<textarea rows="11" name="S1" cols="58">'.$caps.''.<br><br>nl2br('.$aciklama.')<br>nl2br('.$linkler.').'</textarea></p>
<p align="center">
</p>
<p align="center"></p>
<p>&nbsp;</td>
</tr>
</table>'
?>


All I want is simple, this;

<textarea> $caps
<br>
<br>
nl2br($aciklama)
<br>
nl2br($linkler)
</textarea>

But I'm lost in inverted commas, please help.

Keleth
06-27-2010, 09:09 PM
Um... first problem is I see you have F1' half way through, closing the quotes and screwing everything up. Escape it with a \.

Also, what do you mean inverted commas? And in textareas, html appears as paintext, not as HTML formatting. So are you trying to get an image to appear in the textarea? Or the code?

I guess the simple problem is you have a bunch of stuff that isn't properly encapsulated (everything after F1, the breaks before $ackilama). Get those sorted and I don't see why it wouldn't work.

cevaps
06-27-2010, 09:17 PM
Um... first problem is I see you have F1' half way through, closing the quotes and screwing everything up. Escape it with a \.

Also, what do you mean inverted commas? And in textareas, html appears as paintext, not as HTML formatting. So are you trying to get an image to appear in the textarea? Or the code?

I guess the simple problem is you have a bunch of stuff that isn't properly encapsulated (everything after F1, the breaks before $ackilama). Get those sorted and I don't see why it wouldn't work.

F1 was just part of another text i forgot before send it here, so i deleted it.

I just want to write the code in textarea, to use on another php.

Keleth
06-27-2010, 09:26 PM
Well, first like I said, encapsulate the breaks you have. Also, you seem very confused with how to concatenate functions in PHP strings.


'<textarea rows="11" name="S1" cols="58">'.$caps.'<br><br>'.nl2br($aciklama).'<br>'.nl2br($linkler).'</textarea></p>'

Again though, what do you mean by an inverted comma? Do you mean apostrophes?

cevaps
06-27-2010, 09:30 PM
Well, first like I said, encapsulate the breaks you have.

Again though, what do you mean by an inverted comma?

Ah, I see what i wrote wrong.

I mean with inverted comma is ' ' ' ' using in textarea. I guess you thought i'm trying to wrote <br> in textarea too, but i just want to make double enter with <br><br> but it shows <br> in textarea. I want this ;

<textarea> $caps


nl2br($aciklama) - i must use nl2br in php code because all i want is multiline $aciklama

nl2br($linkler) - same with $aciklama. just need multiline $linkler.
</textarea>

I want to get VBB post code. will be in textarea but not nl2br or <br>. I'm trying to use them to change display of code.

So, because of trying to use php commands in textarea, i'm using '. .' but it doenst work. I just need to make double space line after for next sentence.

edit : it'll seem like this http://img710.imageshack.us/img710/1145/76212805.jpg

Keleth
06-27-2010, 09:34 PM
Well... thats why I said, html will appear as plain text in a textarea, not as formatting. If you wanna skip lines in textareas, use new lines (\n).

cevaps
06-27-2010, 09:37 PM
Well... thats why I said, html will appear as plain text in a textarea, not as formatting. If you wanna skip lines in textareas, use new lines (\n).

OK I get it! Thanks for tip.

Edit :

Now i have another problem.

My new code is like you said;


<textarea rows="11" name="S1" cols="58">'.$caps.'

'.nl2br($aciklama).'

'.nl2br($linkler).'</textarea></p>


But nl2br command adds <br> to texts like this :

http://i47.tinypic.com/1z35kye.jpg

Keleth
06-27-2010, 09:54 PM
Because you're telling it to? nl2br means new line to break... you're telling it to replace all new lines with breaks. The function is doing exactly what its supposed to.

cevaps
06-27-2010, 09:56 PM
Hehe please don't get mad. It's the only command that i could find, which transfers multiline texts. I want multiline texts seems in textarea like;

asdf
ghjk


Just without br. Because using directly $aciklama makes my text like;

asdf ghjk

Keleth
06-27-2010, 10:00 PM
Heh, I'm not mad... just sometimes I help people who don't even seem to try. I'm not trying to accuse you of this, just... nuances of language don't work on the interwebs. I'm sorry if I came off aggressive: the function is doing exactly what its meant to, and that's that :)

How are you getting $aciklama? And it shows up as a single line in a textarea when you don't use nl2br? Or it shows up in html as a single line?

cevaps
06-27-2010, 10:05 PM
Hey it worked hehe! Just deleted one last comma that i forgot and it worked. Thanks for your all help. This 10 lines ruined my last 48 hours lol.

Thanks again for making my tiny code alive.

permatec
06-28-2010, 05:52 PM
Ohh,Very good programmer is here.Its my first post and i think this forum will help me to learn PHP... :)



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum