Re: How do I use a Javascript variable in PHP?
| From: | Ivo | Date: | Mon, 23 Sep 2002 15:00:39 +0000 |
| Subject: | Re: How do I use a Javascript variable in PHP? | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-117274@lists.php.net to get a copy of this message | ||
You could do this ONLY by passing the var to a new URL with the desired php
(your script).
Otherwise the php will be executed (on the server) before JS (which will be
executed on the client after receiving the php result page)
regards
Ivo
"Tom" <tom.callaghan@claimnet.co.uk> wrote in message
news:20020923130515.85220.qmail@pb1.pair.com...
> Hi all,
>
>
>
> I hope this is the right place to pose my question, so here goes: -
>
>
>
> I have a javascript function called calcMonth() and given a number it will
> return a date i.e. month = calcMonth( 57 ) - month will be 'sept 2002'
>
>
>
> The problem I
m having is at the beginning of my PHP file Im
> calling this
> calcMonth() then doing a load of php stuff and then trying to use the
> javascript month variable, but to no avail: -
>
>
>
> print "<td><input type=text class=claimreadonly readonly
name=POST_monthdisp
> value=javascript:month; size=10 tabindex=99></td>";
>
>
>
> The result is, the browser displays the words 'javascript:month;' - not a
> month number
>
>
>
> I`ve looked everywhere for an answer from persistent javascript data to
> using framesets to hold the variable but to no avail.
>
>
>
> I know its quite a bit of javascript, but its mixed in with PHP too so I
> thought it`d be the right place.
>
>
>
> Anyways, I hope someone can provide the answer to my problem.
>
>
>
> Thanks in advance,
>
> Tom
>
>
>