Calling strings from fgets
| From: | Kris Howl | Date: | Mon, 14 Aug 2000 04:30:27 +0000 |
| Subject: | Calling strings from fgets | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-11558@lists.php.net to get a copy of this message | ||
Hello,
I have a voting script I knocked up. And in poll.php4 there are the 6
options of what the user can choose. These options are defined in $option# =
"Choice number #";
# Being replaced with a number from 1 to 6.
In results.php4 which shows the graph of how many votes each option has
taken, I want the $option# to appear above the graphic bar.
This is what I have:
----------
function readvar() {
$openvar = fopen("poll.php4","r");
$getvars = fgets($openvar,400000);
global $op1, $op2, $op3, $op4, $op5, $op6;
$op1 = $getvars["$option1"];
$op2 = $option2;
$op3 = $option3;
$op4 = $option4;
$op5 = $option5;
$op6 = $option6;
fclose($openvar);
}
readvar();
print $op1;
---------
$op1 is my testing variable, once I get that to work I'd do the same for the
others... now on the page, $op1 just shows up as: < instead of: Choice
number 1
How can I get it to display "Choice number 1" ?
I've tried putting the fclose above the global statement, and a bunch of
other things but Im doing something wrong..
Hope i explained it well enough, thanks!