Or you can also do this way:
on loading
<?php
[...]
echo "<input type='hidden' name='myphpvar' id='myphpvar'
value='".$myphpvar."'>";
[...]
echo "<input type='button' name='mybutton' id='mybutton'
onclick='javascript:recalculateValue();' value='Click Me!' ";
[...]
?>
<script type="text/javascript">
functino recalculateValue(){
var myText = document.getElementById("myphpvar");
var myValue = myText.value;
/*
operations with myText
*/
myText.value = myRecalcValue;
}
</script>
once changed, you choose how to proceed, maybe executing any other js
funcion that use new value of/for the input, maybe submit the form an take
it from the request in the next page (in the server side, this time).
basicly is use hidden inputs as a container for php variables, and transform
through js.
2009/9/18 Gautam Bhatia <[email protected]>
> hello,
>
> You can also try using AJAX technology to communicate with the server
> side code that is your php :).
>
> Regards,
> Gautam Bhatia
> Punjab,India
> [email protected]
>
>
> On Fri, 2009-09-18 at 02:16 +0700, saeed ahmed wrote:
> > hello guys,
> >
> > i'm new here in this list. guys i need a help. i can't assign a js
> variable
> > value to a php variable. how can i do this?
> >
> >
> > --
> > Regards,
> > Saeed Ahmed
> > Rajshahi, Bangladesh
> > Blog: http://saeed05.wordpress.com
> > --
> > Follow Me Linkedin
> > <http://www.linkedin.com/in/sas05>Twitter<http://twitter.com/saeed05>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>