This is a simple question that I think, but I canβt understand yet. I have a text area, which after sending goes to the database, and then I repeat this text on the page, but here is the problem: let's say a person writes in a text field:
Hi Robert,
This is just a test!
Jason
And the message goes to the database in exactly the same way, but when I repeat this, I get:
Hi Robert, this is just a test !. Jason
This is the form:
<textarea name="newMessage" wrap="hard" cols="30" rows="3"></textarea> <input type="submit" name="submit" value="Ingresar"> </>
This is the code I use to display text:
<?php while($row = mysql_fetch_assoc($messages)){ echo $row['mensaje']."<br/>"; } ?>
This is what I use to insert the code:
if(isset($_POST['submit'])){ $check4LB = $_POST['newMessage']; while($letter = mysql_fetch_assoc($check4LB)){ if($letter=' '){ $letter='<br/>'; } } /////I know this is not write bu is the idea i thgouht at least $query = mysql_query("SELECT (ifnull(max(idRegistro),0) + 1) as id FROM messages"); $row = mysql_fetch_array($query); $idMax = $row['id']; $insertMessage = "INSERT INTO messages(idRegistro, mensaje) VALUES ('".$idMax."','".$letter."')"; mysql_query($insertMessage) or die(mysql_error()); echo "<meta http-equiv=Refresh content=\"0 ; url=".$_SERVER['PHP_SELF']."\">"; }
source share