Reputation: 73
not see data on the textarea
creatDocument.php
<html>
<head>
<script type="text/javascript" src="../jquery-1.8.1.js"></script>
<script language="javascript">
function insertFormulationToTextErea(string){
document.getElementById("argumentId").value = string;
}
</script>
<title></title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<body>
<textarea name="argument" id="argumentId" rows="10" cols="50"></textarea>
<?php
if(isset($_REQUEST['formulation']))
$formulation = $_REQUEST['formulation'];
else $formulation = "No data receive";
$formulation = base64_decode($formulation);
echo "<script>insertFormulationToTextErea('$formulation')
</script>";
echo $formulation;
?>
</body>
</html>
$formulation
is the string parameter that received from another php page with POST
method.
When I use with echo
I see the string value, when I try to insert $formulation
to textarea, the textarea is empty.
When I use with GET
method it work fine, but when $formulation
string too long, the server reported that Request-URI Too Large.
Anybody know this problem or any solution that I can use?
Upvotes: 0
Views: 50
Reputation: 17616
What you're doing looks a bit complex, try simply this:
<textarea name="argument" id="argumentId" rows="10" cols="50" value="<?php echo $formulation; ?>"></textarea>
This puts your string directly into the textarea value
, without trying to use it as a parameter for your function.
AND reason why your you get nothing from $formulation
when you use it as a paramter for your function is because your code should be like so:
echo "<script>insertFormulationToTextErea(".$formulation.")</script>";
Though I highly advise you to avoid coding like that..
Upvotes: 1