Hi, I created a small text editor for my website with my small knowledge. The problem is that each time I publish Something with it it does not show the new paragraph and puts all the text in the same paragraph. Someone can help me to make in a way that each time I press enter it makes a new paragraph? I only know php and a bit of javascript. I have no idea what I could do and what to search for it. Thanks. I'm a begginer so I need an simple language and explanation, I only know some php and javascript, slowly learning.
Here is the code I did:
PHP Code:
<?php
mb_language('uni');
mb_internal_encoding('UTF-8');
if(isset($_POST['submit']))
{
if(!empty($_POST['titre'])&&!empty($_POST['message']))
{
$titre=$_POST['titre'];
$message=$_POST['message'];
$id=$_POST['id'];
$query=mysql_query("INSERT INTO editor(id,titre, message) VALUES
('$id','$titre','$message')");
if($query)
{$select=mysql_query("SELECT * FROM editor ORDER BY id DESC");
while($row=mysql_fetch_assoc($select))
{
echo $row['titre']."<br><strong>".$row['message']."</strong><br>";
}
}
}
} else echo "Vous devez saisir tout les champs pour pouvoir poster un commentaire";
?>
<form method='POST' action='index.php' enctype="multipart/form-data" name="myform">
<strong>Poster un texte</strong>
<p></p>
<p>titulo</p>
<textarea name="titre" rows="2" cols="35"></textarea><br>
<p>Texto</p>
<textarea name="message" style="display:none;" rows="6" cols="35"></textarea><br>
<br>
<input type="submit" name="submit" value="Poster"">
</form>
<?php
$getquery=mysql_query("SELECT * FROM editor ORDER BY id DESC");
$rows=mysql_fetch_assoc($getquery);
do {?>
<div id="a" style="border:2px solid #a1a1a1;
padding:3px 10px;
background:#f2d9f2;
width:260px;
border-radius:10px;
text-decoration:no;"
>
<a href="newsarticle.php?id=<?php echo $rows['id'];?>" target="new"><?php echo $rows['titre'];?></a><br>
<?php echo $rows['message'];?><br>
</div><br>
<?php } while($rows=mysql_fetch_assoc($getquery))
?>
Bookmarks