Click to See Complete Forum and Search --> : passing value to form, receiving, but not printing


Booooze
08-12-2004, 03:58 PM
guys...im having problems with this dam script. what it does is receive 2 values from a php page, and then it is to take 1 value and use it to help open a specific file. that works, but when i go to print the second value to that file thats open, its prints gibberish(the little dam square sign). i dont know what is wront with this!! im receiving both values properly, i checked it using the print function. see if you can see any problems, heres some of the code:


print $id;
print $rate;
$arr = file("Vbdata.txt");

$f = "$arr[$id]";
$f = rtrim($f);

if($fp = fopen("$f/Rate.txt", 'ab'))
{
//print "$rate\r\n";
flock ($fp, LOCK_EX);

fwrite ($fp, "$rate\r\n");

flock ($fp, LOCK_UN);
print "<center><b>Your message has been stored\n\n</b><br/>";


im not getting any errors, its simply not printing the correct value. this is just part of the code where i think its wrong. tell me if you need more. plz and thank you:)

NogDog
08-13-2004, 01:04 PM
Not 100% sure, but I think you'll get what you want if you open your file in "at" (text) mode instead of "ab" (binary):
if($fp = fopen("$f/Rate.txt", 'at'))