taylorswildcreations Posted July 1, 2007 Share Posted July 1, 2007 I need to replace enter with <br> in a textarea on a form. I will post the coding below and maybe one of you can help me. <?php $title=$_POST['title']; $title = str_replace(" ","%20",$title); $section1title=$_POST['section1title']; $section1title = str_replace(" ","%20",$section1title); $section1info=$_POST['section1info']; $section1info = str_replace(" ","%20",$section1info); $section2title=$_POST['section2title']; $section2title = str_replace(" ","%20",$section2title); $section2info=$_POST['section2info']; $section2info = str_replace(" ","%20",$section2info); $section3title=$_POST['section3title']; $section3title = str_replace(" ","%20",$section3title); $section3info=$_POST['section3info']; $section3info = str_replace(" ","%20",$section3info); $lad=$_POST['lad']; $cgi=$_POST['cgi']; $editedby=$_POST['editedby']; $editedby = str_replace(" ","%20",$editedby); $shoutbox=$_POST['shoutbox']; $fontcolor=$_POST['fontcolor']; $theme=$_POST['theme']; if (!isset($_POST['submit'])) { // if page is not submitted to itself echo the form ?> <html> <head> <title>Main Page Generator</title> </head> <body> <form method="post" action="<?php echo $PHP_SELF;?>"> League Name:<input type="text" size="12" maxlength="1000" name="title"><br /> Section 1 Title:<input type="text" size="12" maxlength="1000" name="section1title"><br /> Section 1 Context:<br> <textarea name="section1info" rows="5" class="textbox"></textarea><br> Section 2 Title:<input type="text" size="12" maxlength="1000" name="section2title"><br /> Section 2 Context:<br> <textarea name="section2info" rows="5" class="textbox"></textarea><br> Section 3 Title:<input type="text" size="12" maxlength="1000" name="section3title"><br /> Section 3 Context:<br> <textarea name="section3info" rows="5" class="textbox"></textarea><br> League: <input type="text" size="12" maxlength="100" name="lad"><br /> CGI#: <input type="text" size="12" maxlength="2" name="cgi"><br /> Edited by: <input type="text" size="12" maxlength="100" name="editedby"><br /> Shoutbox Code (Tut coming soon.): <br> <textarea name="shoutbox" rows="5" class="textbox"></textarea><br> <input type="submit" value="submit" name="submit"> </form> <? } else { echo "Please place the following code into the announcement section in your admin panel:<br><textarea rows='3' cols='50'><body onLoad='parent.frames[0].location='http://SITE REMOVED/left.php?lad=".$lad."&cgi=".$cgi."'; parent.frames [1].location='http://SITE REMOVED/main.php?title=".$title."§ion1title=".$section1title."§ion1info=".$section1info."§ion2title=".$section2title."§ion2info=".$section2info."§ion3title=".$section3title."§ion3info=".$section3info."&lad=".$lad."&cgi=".$cgi."&editedby=".$editedby."&shoutbox=".$shoutbox."&fontcolor=bad2d4&theme=summer/1'';></textarea>"; } ?> I only need to replace them on section1info section2info and section3info And if its not too much to ask i need to delete all enters on shoutbox... not replace them, just delete them completely. Please I need help!!! Quote Link to comment Share on other sites More sharing options...
Cless Posted July 1, 2007 Share Posted July 1, 2007 Err, what do you mean? Could you be more clear? Plus, please put your coding in the following code: ['code']ScriptHere[/'code'] Remove the ' in the tags. Thank you. Quote Link to comment Share on other sites More sharing options...
teng84 Posted July 1, 2007 Share Posted July 1, 2007 And if its not too much to ask i need to delete all enters on shoutbox... not replace them, just delete them completely. ^^ what do you mean no sql so is it the reset property of the button you are talking Quote Link to comment Share on other sites More sharing options...
AndyB Posted July 1, 2007 Share Posted July 1, 2007 I'm not too sure what all that code is about, but I do know that the nl2br() function converts newlines (enters) into html line breaks. Use it when displaying output from your database(?). http://ca.php.net/manual/en/function.nl2br.php Quote Link to comment Share on other sites More sharing options...
Cless Posted July 2, 2007 Share Posted July 2, 2007 And if its not too much to ask i need to delete all enters on shoutbox... not replace them, just delete them completely. ^^ what do you mean no sql so is it the reset property of the button you are talking ...Okay. Now I'm seriously confused. o.O Quote Link to comment Share on other sites More sharing options...
taylorswildcreations Posted July 2, 2007 Author Share Posted July 2, 2007 I am not sure how else to say this....... ummm I need the enters in variables section1info section2info and section3info to be converted into < br >s I need the enters in the variable shoutbox to be deleted. Here is the code again. <?php $title=$_POST['title']; $title = str_replace(" ","%20",$title); $section1title=$_POST['section1title']; $section1title = str_replace(" ","%20",$section1title); $section1info=$_POST['section1info']; $section1info = str_replace(" ","%20",$section1info); $section2title=$_POST['section2title']; $section2title = str_replace(" ","%20",$section2title); $section2info=$_POST['section2info']; $section2info = str_replace(" ","%20",$section2info); $section3title=$_POST['section3title']; $section3title = str_replace(" ","%20",$section3title); $section3info=$_POST['section3info']; $section3info = str_replace(" ","%20",$section3info); $lad=$_POST['lad']; $cgi=$_POST['cgi']; $editedby=$_POST['editedby']; $editedby = str_replace(" ","%20",$editedby); $shoutbox=$_POST['shoutbox']; $fontcolor=$_POST['fontcolor']; $theme=$_POST['theme']; if (!isset($_POST['submit'])) { // if page is not submitted to itself echo the form ?> <html> <head> <title>Main Page Generator</title> </head> <body> <form method="post" action="<?php echo $PHP_SELF;?>"> League Name:<input type="text" size="12" maxlength="1000" name="title"> Section 1 Title:<input type="text" size="12" maxlength="1000" name="section1title"> Section 1 Context: <textarea name="section1info" rows="5" class="textbox"></textarea> Section 2 Title:<input type="text" size="12" maxlength="1000" name="section2title"> Section 2 Context: <textarea name="section2info" rows="5" class="textbox"></textarea> Section 3 Title:<input type="text" size="12" maxlength="1000" name="section3title"> Section 3 Context: <textarea name="section3info" rows="5" class="textbox"></textarea> League: <input type="text" size="12" maxlength="100" name="lad"> CGI#: <input type="text" size="12" maxlength="2" name="cgi"> Edited by: <input type="text" size="12" maxlength="100" name="editedby"> Shoutbox Code (Tut coming soon.): <textarea name="shoutbox" rows="5" class="textbox"></textarea> <input type="submit" value="submit" name="submit"> </form> <? } else { echo "Please place the following code into the announcement section in your admin panel: <textarea rows='3' cols='50'><body onLoad='parent.frames[0].location='http://taylorswildcreations.com/left.php?lad=".$lad."&cgi=".$cgi."'; parent.frames [1].location='http://taylorswildcreatons.com/main.php?title=".$title."§ion1title=".$section1title."§ion1info=".$section1info."§ion2title=".$section2title."§ion2info=".$section2info."§ion3title=".$section3title."§ion3info=".$section3info."&lad=".$lad."&cgi=".$cgi."&editedby=".$editedby."&shoutbox=".$shoutbox."&fontcolor=bad2d4&theme=summer/1'';></textarea>"; } ?> There is no sql database. It takes the varibles entered in and put it into a code. Its somewhat of a generator. Quote Link to comment Share on other sites More sharing options...
AndyB Posted July 2, 2007 Share Posted July 2, 2007 str_replace("\r\n","",$whatever); // will remove the 'enters' str_replace("\r\n","<br>",$whatever); // will replace the 'enters' 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.