PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
<?php
// Make Random Number
$R=(rand(1,9));
echo $R;
?>
I have the above code, this $R is needed on other pages. How do I make it carry over to the other pages. On the second page then (echo $R;) does not show up.
I have searched for thks and can't seem to find an answer. I can't use the command to pit in in a text file and store on the server, as other users will over write it.
pauls74462 wrote:I have the above code, this $R is needed on other pages. How do I make it carry over to the other pages. On the second page then (echo $R;) does not show up.
I have searched for thks and can't seem to find an answer. I can't use the command to pit in in a text file and store on the server, as other users will over write it.
You either pass it in the URL for the next page, and access it as a $_GET parameter, or you store it in a session file (which won't get overwritten by other users)
Read about PHP sessions (http://php.net/sessions), they are used to keep data alive for user only while session is alive. If you want to store data for longer time period you can use cookies or * database instead.