kbroka 0 Report post Posted March 23, 2003 i want to hear who is interested to gain knowledge of coding. I need to discuss about coding. Your help will be appreciated. thanks. Quote Share this post Link to post Share on other sites
Bimal Paudel 0 Report post Posted March 23, 2003 Hi KB buddy, are you talkin about seeking help or offering help? Quote Share this post Link to post Share on other sites
kbroka 0 Report post Posted March 24, 2003 QUOTE (Bimal Paudel @ Mar 23 2003, 11:20 PM) Hi KB buddy, are you talkin about seeking help or offering help? i need both. u need ? Quote Share this post Link to post Share on other sites
kbroka 0 Report post Posted March 24, 2003 let's see check : i have this problem $user = "test"; if ($pw == $user) { header("Location: test.php"); } else { header("Location: user.php"); } ?> it's return this error: headers already sent...' or 'Cannot add header information. my i know how to solve this problem. Quote Share this post Link to post Share on other sites
sanskar 0 Report post Posted March 24, 2003 Dear KB ji, I am also learning php and i am happy that you raised this coding problem here. Actually, i am very new to php, but i think, i got your problem. Actually, PhP, itself sends header automatically, but if you want to send header on own, for this, you have to make sure that no output has been sent to browser already. In your code, it seems that, php has sent header already and you are trying to send again, so thats why error. I am not sure, but try same code with adding exit; in both place after header call, like this: <?php $user = "test"; if ($pw == $user) { header("Location: test.php"); exit; } else { header("Location: user.php"); exit; } ?> Quote Share this post Link to post Share on other sites
kbroka 0 Report post Posted March 24, 2003 thanks sanskar ji, i did, but it also give same Warning: Cannot add header information - headers already sent by Quote Share this post Link to post Share on other sites
Himal Rai 0 Report post Posted March 25, 2003 (edited) aafulai ta aaudaina Coding (PHP) ..tar willing to learn so I downloaded ta manual from this site http://www.php.net/download-docs.php yesterday and going through it. Ahile samma chahi kalo akchhar bhaisi barabar bhaeko chha. I will join you guys sooner or later. Till then do continue.... cheers Edited March 25, 2003 by Himal Rai Quote Share this post Link to post Share on other sites
sanskar 0 Report post Posted March 25, 2003 Dear KB ji, Sad to know that it did not work. I am also new so do not know really much. Would you mind to post whole code here? Are you sure that this particular section of code is creating error or something else? Himal ji.. chandai sikhanu paryo.. malai pani kalo achhar bhaisni barabar laagdai chha.. but its interesting.. wish other expert people also join here and help each other. regards, Quote Share this post Link to post Share on other sites
kbroka 0 Report post Posted March 25, 2003 QUOTE (sanskar @ Mar 25 2003, 10:42 AM) Dear KB ji, Sad to know that it did not work. I am also new so do not know really much. Would you mind to post whole code here? Are you sure that this particular section of code is creating error or something else? Himal ji.. chandai sikhanu paryo.. malai pani kalo achhar bhaisni barabar laagdai chha.. but its interesting.. wish other expert people also join here and help each other. regards, Dear Sanskar & Himal ji, thanks for your help. Nope i am also learning stage. i am getting this trouble in Apache which is i used in win 98. sanskar ji your adding exit; code is right. i hope another guys also will join here and share knowledge each & every others. Thanks Quote Share this post Link to post Share on other sites
linuxuser 0 Report post Posted March 26, 2003 kbroka, As Sanskar indicated, it is hard to tell where the error is emersing by looking at 4 lines of codes. Also I am no PHP expert But i would suggest you to check the followings. 1) Do not set a cookie after using header() or include() or any of those type of functions. If you need to do it this way then buffer the output before sending the headers. 2) Also, make sure you're not sending any blank spaces/lines before you send your cookie. Check any include files, look for spaces after the closing ?> Quote Share this post Link to post Share on other sites