vinpkl Posted October 25, 2008 Share Posted October 25, 2008 hi all i would like to ask that i have a <textarea> and in that i can insert 3 lines. If the content is entered with "pressing enter" after each line then i want that 3 lines ouput should come with a break after each line. means i just want to add <br> after each line ouput. the name of <textarea> is shipping_detail. $shipping_detail=$_REQUEST['shipping_detail']; vineet Quote Link to comment Share on other sites More sharing options...
phpretard Posted October 25, 2008 Share Posted October 25, 2008 Can you post your code that is sent after submit? Quote Link to comment Share on other sites More sharing options...
vinpkl Posted October 25, 2008 Author Share Posted October 25, 2008 Can you post your code that is sent after submit? hi here is the code if(isset($_REQUEST['submit'])) { $shipping_detail=$_REQUEST['shipping_detail']; $warranty=$_REQUEST['warranty']; $insertqry="insert into product_table(shipping_detail,warranty) values('$shipping_detail','$warranty')"; if(mysql_query($insertqry)) $msg="shipping Product added successfully"; else $msg="Error Inserting new product"; } Here is the result -------------------- 3-7 days shipping. Product shipped from delhi. ---------------------- I want to insert <br> before Product word starts Quote Link to comment Share on other sites More sharing options...
phpretard Posted October 25, 2008 Share Posted October 25, 2008 I assume shipping details is: 123 Street 2nd Address SomeWhere, ST 12345 I don't have a lot of stars by my name but this is how I handle address info. It makes validation easier also. <? if(isset($_POST['submit'])) { $Street1=$_REQUEST['Street1']; $Street2=$_REQUEST['Street2']; $City=$_REQUEST['City']; $State=$_REQUEST['State']; $Zip=$_REQUEST['Zip']; /** put your insert code here **/ echo $Street1; echo $Street2; echo $City; echo $Zip; /** end your insert code here **/ } ?> <form action='' method=post> <input name='Street1' size=40 /><br /> <input name='Street2' size=40 /><br /> <input name='City' size=20 /><input name='State' size=2/><input name='Zip' size=9 /> <br /><br /> <input type=submit name=submit value=submit> </form> Quote Link to comment Share on other sites More sharing options...
vinpkl Posted October 25, 2008 Author Share Posted October 25, 2008 I assume shipping details is: 123 Street 2nd Address SomeWhere, ST 12345 I don't have a lot of stars by my name but this is how I handle address info. It makes validation easier also. <? if(isset($_POST['submit'])) { $Street1=$_REQUEST['Street1']; $Street2=$_REQUEST['Street2']; $City=$_REQUEST['City']; $State=$_REQUEST['State']; $Zip=$_REQUEST['Zip']; /** put your insert code here **/ echo $Street1; echo $Street2; echo $City; echo $Zip; /** end your insert code here **/ } ?> <form action='' method=post> <input name='Street1' size=40 /><br /> <input name='Street2' size=40 /><br /> <input name='City' size=20 /><input name='State' size=2/><input name='Zip' size=9 /> <br /><br /> <input type=submit name=submit value=submit> </form> hi well its not address its detail about shipping, how many days wil it take, from where product will be shipped, about courier and all that. it can be 3 lines, may be 5 or 6. thats why i have inserted <textarea>. Here is the result -------------------- 3-7 days shipping. Product shipped from delhi. ---------------------- I want to insert <br> before Product word starts. if i didnt get any solution for <textarea> then i have to adopt your solution. vineet Quote Link to comment Share on other sites More sharing options...
phpretard Posted October 25, 2008 Share Posted October 25, 2008 This will handle the breaks the quotes the single quotes... if(isset($_POST['submit'])) { $info=$_REQUEST['info']; $info=stripslashes($_POST['info']); $info=htmlentities($info, ENT_QUOTES); $info=nl2br($info); /** put your insert code here **/ echo $info; /** end your insert code here **/ } ?> <form action='' method=post> <textarea name=info rows="5" cols="36"></textarea> <input type=submit name=submit value=submit> </form> Quote Link to comment 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.