newyear498 Posted August 13, 2010 Share Posted August 13, 2010 I have this script which I will post below.. the problem is that the following script only works with number.. when I use this script the error.txt will only write numbers and if I send text like... ?trueId=hey nothing happens but ?trueId=1 works just fine.. heres the script <?php $handle = fopen('error.txt', 'r+'); $trueId = $_GET[trueId]; $nextLine = false; $realText = false; while(!feof($handle) && $realText != $trueId) { $nextLine = fgets($handle); $realText = $nextLine + "\n"; } if($realText != $trueId){ $break = "\n"; $text = $trueId; fwrite($handle, $break); fwrite($handle, $text); fclose($handle); ?> THANK YOU! Appreciate the help! Quote Link to comment https://forums.phpfreaks.com/topic/210614-php-get-method-sending-variables/ Share on other sites More sharing options...
newyear498 Posted August 13, 2010 Author Share Posted August 13, 2010 wow its late.. I been programming to much, back and forth with javascript I put + rather than . and I was using GET ment to do POST its time for coffee Quote Link to comment https://forums.phpfreaks.com/topic/210614-php-get-method-sending-variables/#findComment-1098753 Share on other sites More sharing options...
Alex Posted August 13, 2010 Share Posted August 13, 2010 You should also have quotes around that array index. It will throw an undefined constant warning if you have your error reporting turned up high enough. Quote Link to comment https://forums.phpfreaks.com/topic/210614-php-get-method-sending-variables/#findComment-1098755 Share on other sites More sharing options...
newyear498 Posted August 13, 2010 Author Share Posted August 13, 2010 You should also have quotes around that array index. It will throw an undefined constant warning if you have your error reporting turned up high enough. I never knew you were supposed to do quotes around that, I never really considered the GET/POST methods to be array indexs, good thing to know, appreciate it!!! Quote Link to comment https://forums.phpfreaks.com/topic/210614-php-get-method-sending-variables/#findComment-1098761 Share on other sites More sharing options...
www333 Posted August 13, 2010 Share Posted August 13, 2010 $trueId = $_GET[trueId]; ------ $trueId = $_GET['trueId']; if($realText != $trueId){ $break = "\n"; $text = $trueId; fwrite($handle, $break); fwrite($handle, $text); } Quote Link to comment https://forums.phpfreaks.com/topic/210614-php-get-method-sending-variables/#findComment-1098766 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.