Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.javascript > #15370
| From | thejustpark <thejustpark@gmail.com> |
|---|---|
| Newsgroups | comp.lang.javascript |
| Subject | how to pass text set in a javascript? |
| Date | 2012-08-15 18:34 -0700 |
| Organization | http://groups.google.com |
| Message-ID | <855e4568-1663-4362-8e47-e97873cdd33f@googlegroups.com> (permalink) |
In my php page, I have this text area whose text data I want to pass to the php code set in the action field.
This is working, when I type something in the area.
But then, I placed a little button below the text area, so that if a user clicks on it, an example text gets on there.
Then, I expect that if I click on the submit button, the example text is passed to next.php .
But I find it not working.
OK, let me summarize with a code snippet.
<script type="text/javascript">
<!--
function loadExample() {
document.forms["region"].elements['fgData'].value = "asdf";
alert("asdf");
}
//-->
</script>
<form name="region" action="calculator_sub.php" method="post" enctype="multipart/form-data" target="_self">
<textarea id="fgData" name="fgData" class="xxlarge" rows="10" disabled="disabled"> </textarea>
<input type="button" value="Example load" onclick="loadExample();">
<input type="submit" class="btn primary" id="submit_button" value="Submit">
</form>
The button actually puts "asdf" on fgData text area.
But when I do
<?php
echo "<pre>";
print_r($_POST);
echo "</pre>";
?>
in next.php, there isn't even a variable named fgData.
What am I missing to pass the data?
Thanking in advance,
Justpark.
Back to comp.lang.javascript | Previous | Next — Next in thread | Find similar | Unroll thread
how to pass text set in a javascript? thejustpark <thejustpark@gmail.com> - 2012-08-15 18:34 -0700 Re: how to pass text set in a javascript? thejustpark <thejustpark@gmail.com> - 2012-08-15 21:24 -0700
csiph-web