Jump to content

Replace enter with <br>


Recommended Posts

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."&section1title=".$section1title."&section1info=".$section1info."&section2title=".$section2title."&section2info=".$section2info."&section3title=".$section3title."&section3info=".$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!!!

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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."&section1title=".$section1title."&section1info=".$section1info."&section2title=".$section2title."&section2info=".$section2info."&section3title=".$section3title."&section3info=".$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.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.