I have an HTML document that has a form
. Parts of the form are text areas where I want the inputter to enter details on several lines. "Description".
function myJSscript() {
var description = document.getElementById('description').value;
var form = document.createElement("form");
form.setAttribute("action", "upload_file.php");
form.setAttribute("enctype", "multipart/form-data");
form.setAttribute("method", "POST");
form.setAttribute("target", "_self");
form.innerHTML = '<input type="text" name="description" value="' + description + '"/>'
form.submit();
}
HTML code
<form name="dform" id="t1">
<textarea rows="5" name="description" id="description" class="tbox2"></textarea>
<input type="button" class="submitblue" value="Submit" onclick="myjscript()">
</form>
in my upload_file.php
I want to add the textarea to a multicell, but no matter what I try (eg nl2br) it always comes through as a single string of text. even echoing the value to screen shows no <br />
or tags. HELP!
Here is the PHP Line that writes the textarea to a multicell
$pdf->MultiCell(0, 5, $_POST['description']);
</div>
You use <textarea>
(multiple lines) in your HTML and <input>
(one line) in JavaScript that removes the linebreaks.