I have an issue which I can't seem to fix.
I have a form and inside the form is a <textarea>
which has text already populated. My problem is when I go to look at the form, the text displays outside of the textarea, not inside which is problematic!
I have the following:
HTML
<div class="passenger_Container">
<div class="names">
<strong>Joe Bloggs</strong>
</div>
<div class="package">
<!-- passenger detail goes here. You will find the code in includes/passenger_Detail.php -->
</div>
</div> <!-- .passenger_Container -->
jQuery
j$('.names strong').click(function(e) {
//find passenger ID - note input[name='customer_ID'] isn't shown in this example
var customer_ID = j$(this).closest('.passenger_Container').find("input[name='customer_ID']").val();
//Use jQuery to find placement of returned data
var insert_Data = j$(this).closest('.passenger_Container').find('.package');
j$.ajax({
type: "POST",
url: "/include/passenger_Detail.php",
data: { customer_ID_Data : customer_ID },
success: function(data) {
//console.log("Returned data: "+data);
//get returned data and add into appropriate place
insert_Data.html(data);
//re-initialise WYSIWYG editor. Notes is the ID to re-initialize
tinyMCE.execCommand('mceAddControl', true, 'notes');
}
});
});
PHP - passenger_Detail.php
<?php
$customer_ID = $_REQUEST['customer_ID_Data'];
$query = mysqli_query($conn,"SELECT * FROM Customers WHERE customer_ID = ".$customer_ID." ORDER BY l_Name asc")
or die("Error: ".mysqli_error($conn));
$row = mysqli_fetch_array($query);
$orderQuery = mysqli_query($conn,"SELECT * FROM Orders WHERE customer_ID=".$row['customer_ID']."")
or die("Error: ".mysqli_error($conn));
$rowOrder = mysqli_fetch_array($orderQuery);
?>
<textarea type="text" name="notes" class="form-control notes" id="notes" />
<?php
echo $rowOrder['Notes'];
?>
</textarea>
TL;DR - text echoed ($rowOrder['Notes'];
) in PHP file displays outside of textarea, not inside.
I don't know what's causing this. Any help would be fantastic!