I have a problem of passing data from one textarea to another textarea on another page. I’m using php POST function in order to retrieve data from the first page. Also, I have JavaScript inserting data into the textarea on the first page with the help of JSON and PHP talking to MySQL database. Inserting data into textarea from the database on the first page works.
When I click on the submit button on the first page, no data is passed to the second page. Many thanks for your help.
Page 1
-----------------------------------------------------------------------------------------
<form action="page2.php" method="post" id="role" name="roleForm">
<fieldset id="fieldset">
<legend id="legend">Background</legend>
<p>
<label for="background"></label>
<textarea name="background" cols="71" rows="10" id="backgroundtext">
</textarea></p>
</fieldset>
<br></br>
<p><input type="submit" name="Submit" value="Add role to job description" id="addjobdesc" /></p>
</form>
JavaScript file (part of the file)
---------------------------------------------------------------------------------------
function set_background (newValue)
{
var field = document.roleForm.backgroundtext;
field.value = newValue;
}
page2.php
-------------------------------------------------------------------------------------------
<fieldset id="fieldset">
<legend id="legend">Background</legend>
<p>
<label for="background2"></label>
<textarea name="background2" cols="71" rows="10" id="backgroundtext2" value="<?php echo $_POST["background"]; ?>"/>
</textarea></p>
</fieldset>
<br></br>