Jump to content
Sign in to follow this  
kbroka

Coding

Recommended Posts

i want to hear who is interested to gain knowledge of coding.

 

I need to discuss about coding.

 

Your help will be appreciated.

 

 

thanks.

Share this post


Link to post
Share on other sites
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 ?

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

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;

}

?>

 

Share this post


Link to post
Share on other sites

thanks sanskar ji,

 

i did, but it also give same Warning: Cannot add header information - headers already sent by

 

 

Share this post


Link to post
Share on other sites

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. biggrin.gif

 

I will join you guys sooner or later.

Till then do continue....

 

cheers

Edited by Himal Rai

Share this post


Link to post
Share on other sites

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,

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites

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 smile.gif

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 ?>

 

 

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
Sign in to follow this  

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.