hi

i dont know how it works in JS but in PHP is
var codeofheight = "<?php echo $codeofheight; ?>";
but i need it in JS... the opossite of this code

thnx

Recommended Answers

All 4 Replies

> var codeofheight = "<?php echo $codeofheight; ?>";
When enclosed in script tags, this is JS, not PHP.

> the opossite of this code
Opposite in what sense?

I think he wants to import a javascript variable into PHP. the easiest way would be to write the variable to a hidden form element then retrieve it in REQUEST data.

thats what im lookin for in ShawCplus...
can you show me some example ?

Well you would have a hidden form field

<input type="hidden" name="SomeName" id="someID" value=""/>

Then you would use javascript to set the value.

document.getElementById('someID').value = "Something here";

Then in PHP you would retrieve that after the page was submitted.

$someName = $_REQUEST['SomeName'];
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.