I’m new to PHP and so don’t know how to get around this problem.
I have 2 php scripts and i want to display a variable from one of the srcipts in the other script. To display a variable in HTML I use
[code=php]
<?php echo $somevariable; ?>
If I put this variable in my HTML it displays correctly. But when I put it inside the other PHP code it doesn’t work. When I view source the above code is displayed instead of just the variable.
I should say that script 1 decides which stylesheet to print into the HTML. Script 2 generates a random number from an array, which then needs to be printed with script 1.
Does that make sense? Probably not. I’ve found it hard to explain. Another way to look at is: How can I have this:
[code=php]
<?php
script 1
<?php echo $variable_from_script2; ?>
script 1
?>