I'm sending text from a text area which is being sent into a mysql database and then being shown elsewhere on another page.
If i input for example:
text
text
text
into the text area, i simply receive
text text text
I understand i need to create a new line some how between the text, but really unsure on the way to go about it as it is being stored in MySQL as
text||text||text
<div class="panel-heading">Addservices</div> <div class="panel-body"> <div class="block"> <form method="POST" action="page.php"> <p>Add service title:</p> <input type="text" class="form-control" name="servicetitle" value=""><br /> </div><div class="block"> <p>Add service content:</p> <textarea id="b" type="text" class="form-control" name="servicecontent"></textarea> </div> <input class="btn btn-primary btn-md" type="submit"> </form> </div>
Code where it is being pulled from
<?php $getService = $conn->query("SELECT id, value FROM customerlanding WHERE element = 'service'"); while ($row = $getService->fetch_assoc()) { $id = $row['id']; $split = explode("||", $row['value']); echo' <div class="col-md-4"> <div class="text-column text-column-centralized tex-column-icon-lg this-animate" data-animate="fadeInLeft"> <div class="text-column-icon"> <span style="background-color:'; echo $result['primarycolour']; echo '"class="fa"></span> </div> <h4>'; echo $split[0]; echo '</h4> <div class="text-column-info"> '; echo $split[1]; echo ' </div> </div> </div>'; } ?>
.
if(isset($_POST['servicetitle'])){ $service = $_POST['servicetitle']."||".$_POST['servicecontent']; $insertservice = $conn->query("INSERT INTO `customer`(`customerid`, `element`, `value`) VALUES ('10','service','$service')");
解决了。
echo nl2br($split[1]);
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.