i'm trying to assign a value to a variable in php, and then pass that value to a variable inside a script but i dont have any idea how to do that.
Code: Select all
<?
if ( isset( $resultConfig ) && ! empty( $resultConfig ) ) {
$sepID = 'config';
} else {
$sepID = 'car';
}
?>
<script language="javascript">
var oldsep = <? echo $sepID; ?>;
</script>EDITED:
i've got a example from a page where they give this code, but i cant make it work
Code: Select all
//In either way, the PHP script gets the passed values like
$lat = $_REQUEST['lat'];
//After processing these values in PHP, you can pass the processed values to Javascript like
var new_lat = <? echo $new_lat; ?>;thanks in advance