Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to use javascript variables in PHP [duplicate]

Tags:

javascript

php

Possible Duplicate:
How can I use a JavaScript variable as a PHP variable?

I need to use javascipt variables in PHP, how can I do that?

eg:

<script>
var abc = 'this is text';
</script>

How can I read variable abc in php?

like image 361
Kode Plus Avatar asked Nov 22 '25 16:11

Kode Plus


1 Answers

I am not sure will this help you in anyway. But in this way you can use javascript in server side.

<script type="text/javascript">
var abc= 'this is text';
<?php $abc = "<script>document.write(abc)</script>"?>   
</script>
<?php echo $abc;?>
like image 85
Pradeeshnarayan Avatar answered Nov 25 '25 06:11

Pradeeshnarayan