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> Quote 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> Quote 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 Quote 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 Quote 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> Quote 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 ! Quote Link to comment https://forums.phpfreaks.com/topic/107835-solved-form-initial-value/#findComment-552790 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.