开发者

put javascript value into php

开发者 https://www.devze.com 2023-02-09 16:14 出处:网络
I have a form that when the person selects the date I want the value to go into a php function. I can view the value by using this.form.orderdate.value, but I want to put that value into the php varia

I have a form that when the person selects the date I want the value to go into a php function. I can view the value by using this.form.orderdate.value, but I want to put that value into the php variable $dateChosen

Here is the page so far:

TDM KML Generator 开发者_开发问答

<form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post">
    <script type="text/javascript">DateInput('orderdate', true, 'YYMMDD')</script>
    <input name="submit" type="submit" value="get KML" />

</form>
</body>


Javascript is all executing on the client machine, with the exception of an ajax call (which is still browser/client side and is making a request to a server-side function). PHP happens all server-side. In your case, you're trying to do something that isn't possible, because the PHP script is no longer executing by the time the page is rendered in the browser and the javascript is able to execute.

0

精彩评论

暂无评论...
验证码 换一张
取 消