Basically, I need to create a php script that does the following.
1. States a variable
2. Sends the variable to another domath.php script
3. Receives the result from the domath.php script
4. Prints the result
Is there any way to do this without requiring the user to click anything?
Sending and receiving variables within a single script.
Moderator: General Moderators
There are potentially a couple ways you could do this:
- You could include() the domath.php script. Including a file essentially runs it. So, you could declare the variable, include domath.php and have the results stored in your script:
Code: Select all
//index.php <?PHP $a = 2; $b = 6; include('domath.php'); echo $result; ?> //domath.php <?PHP $result = $a + $b; ?> //output would be: 8 - The other option would be to call that php script via the command line and capture the output from the file. Passing variables that way gets a little trickier though.
Real programmers don't comment their code. If it was hard to write, it should be hard to understand.
My problem is that I need to state a variable and echo the variable in order for my Flash file on the page to be able to load the variable. The problem comes in that I dont have anywhere to echo the variable as it will look quite crappy.
My plan was going to be to echo the variable on a seperate page.
My plan was going to be to echo the variable on a seperate page.