我有一個將數據從一個textarea傳遞到另一個頁面上的另一個textarea的問題。我使用PHP POST函數來從第一頁中檢索數據。另外,在JSON和PHP與MySQL數據庫交談的幫助下,我有JavaScript將數據插入第一頁的textarea。在第一頁的數據庫中插入數據到textarea中的作品。使用POST將數據從一個textarea傳遞到另一個頁面上的另一個頁面
當我點擊第一頁上的提交按鈕時,沒有數據被傳遞到第二頁。非常感謝您的幫助。
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>
非常感謝您的回答。它現在可行!問題已解決。我之所以將它寫入value屬性是因爲我已經看到它在中使用的示例。 – 2011-03-18 20:35:12
@Igor我很高興能幫助你! – strauberry 2011-03-19 07:37:04