liamloveslearning Posted May 29, 2008 Share Posted May 29, 2008 Hey all, im just setting an initial value in my form field and having trouble putting a break under my own text, then the "echo'd" data; im not sure if you can use tags in form fields so if anyone can give me some pointers itd be great, thanks <textarea name="message" type="text" id="message" value="" cols="20" rows="20"style="width:470px;resize:none;">----------------- Original Message -----------------<?php echo $row_reply_msg_id['message']; ?></textarea> Link to comment https://forums.phpfreaks.com/topic/107835-solved-form-initial-value/ Share on other sites More sharing options...
pocobueno1388 Posted May 29, 2008 Share Posted May 29, 2008 Try using the nl2br() function <textarea name="message" type="text" id="message" value="" cols="20" rows="20"style="width:470px;resize:none;">----------------- Original Message -----------------<?php echo nl2br($row_reply_msg_id['message']); ?></textarea> Link to comment https://forums.phpfreaks.com/topic/107835-solved-form-initial-value/#findComment-552781 Share on other sites More sharing options...
liamloveslearning Posted May 29, 2008 Author Share Posted May 29, 2008 thanks, it doesnt seem to have worked however; can I ask what does the nl2br function mean/do? thanks again Link to comment https://forums.phpfreaks.com/topic/107835-solved-form-initial-value/#findComment-552783 Share on other sites More sharing options...
jonsjava Posted May 29, 2008 Share Posted May 29, 2008 converts new lines ("enters", if you will) to HTML line breaks Link to comment https://forums.phpfreaks.com/topic/107835-solved-form-initial-value/#findComment-552785 Share on other sites More sharing options...
jonsjava Posted May 29, 2008 Share Posted May 29, 2008 Hey all, im just setting an initial value in my form field and having trouble putting a break under my own text, then the "echo'd" data; im not sure if you can use tags in form fields so if anyone can give me some pointers itd be great, thanks <textarea name="message" type="text" id="message" value="" cols="20" rows="20"style="width:470px;resize:none;">----------------- Original Message -----------------<?php echo $row_reply_msg_id['message']; ?></textarea> proper solution: <textarea name="message" type="text" id="message" value="" cols="20" rows="20"style="width:470px;resize:none;">----------------- Original Message -----------------<?php print "\n";echo $row_reply_msg_id['message']; ?></textarea> Link to comment https://forums.phpfreaks.com/topic/107835-solved-form-initial-value/#findComment-552787 Share on other sites More sharing options...
liamloveslearning Posted May 29, 2008 Author Share Posted May 29, 2008 ahh thanks jonsjava that cracked it, thanks ! Link to comment https://forums.phpfreaks.com/topic/107835-solved-form-initial-value/#findComment-552790 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.