bob_rock Posted December 25, 2006 Share Posted December 25, 2006 Hello , I just started with php and i have a problem with new line in text.I would like that "email" text will be shown in different line that "textarea".I really don't know where to put /n. If this question was answered 10000 times i'm sorry .... ;)Thank you[code]<form method="post" action="<?php echo $PHP_SELF;?> "><textarea rows="5" cols="20" name="quote" wrap="physical"></textarea><br />email: <input type="text" size="12" name="email" ;<input type="submit" value="submit" name="submit"><br /></form><?php$besedilo=$_POST["quote"];$email=$_POST["email"];$ime="text.txt";$datoteka=fopen($ime,'a')or die ("napaka pri odpiranju datoteke");fwrite($datoteka,$besedilo);fwrite($datoteka,$email);fclose($datoteka);?><br /><?php $tekst = "text.txt";$fh = fopen($tekst, 'r');$vsebina = fread($fh, filesize($tekst));fclose($fh);echo $vsebina;?>[/code] Link to comment https://forums.phpfreaks.com/topic/31814-noob-question/ Share on other sites More sharing options...
Shu Posted December 25, 2006 Share Posted December 25, 2006 $example = "merry\nchrismas";merrychrismasnot sure if this is what u want Link to comment https://forums.phpfreaks.com/topic/31814-noob-question/#findComment-147520 Share on other sites More sharing options...
bob_rock Posted December 25, 2006 Author Share Posted December 25, 2006 yep i know how to use it when it's in a text but in my case if you did take a look at it , i got two variables in fwrite function ($besedilo and $email). I want $besedilo in one line and $email in one line, so when I will use fopen and use text that have been saved in file in one line there will be $besedilo and under this will be $email.Thanks for you efford anyway :) Link to comment https://forums.phpfreaks.com/topic/31814-noob-question/#findComment-147523 Share on other sites More sharing options...
Shu Posted December 25, 2006 Share Posted December 25, 2006 fwrite($datoteka,"$besedilo\n$email"); Link to comment https://forums.phpfreaks.com/topic/31814-noob-question/#findComment-147525 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.