Re: Javascript and PHP
| From: | Tom Rogers | Date: | Wed, 06 Nov 2002 15:55:04 +0000 |
| Subject: | Re: Javascript and PHP | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-123015@lists.php.net to get a copy of this message | ||
Hi,
Wednesday, November 6, 2002, 2:52:31 AM, you wrote:
vaue> Hi. I'm not sure if is here where i have to ask this, but, if it's
vaue> not i hope you say to me :D.
vaue> Well the question is: i want to know how can i make to insert into
vaue> the $_GET or $_POST arrays, an entry with a value from javascript.
vaue> Thanks
This is a post method:
<script language="JavaScript">
function doit(){
testval = "Hello";
document.form1.result.value = testval;
document.form1.submit();
}
</script>
<form name="form1" action="<?echo $_SERVER['PHP_SELF']?>"
method="post">
<input type="hidden" name="result">
<input type="button" value="Submit" onclick="doit();">
</form>
should end up with $_POST['result'] = Hello
--
regards,
Tom