i have an if/else statement and i want the page to redirect to another page in the else part (i tired header, it doesnt seem to work).
OK, thanks for letting us know... how about you post the code? Or do you think we can magically re-create and fix what you have there?
Well is there some other way to redirect besides using header. its as simple as this: <?php if (file_exists("images/$c.jpg")) { echo "<img src='images/$c.jpg' border=1>"; } else { echo "<br>No more<br><a href=index.php><b>Click here</b></a> to go home or <a href=c.php?c=1><b>click here</b></a> to go back to the first image"; } ?> PHP: I want to redirect to c.php?c=1
You can't echo anything before redirecting. Anything echoed after redirecting, obviously won't be shown. So drop the text and redirecting via header should work. Otherwise try a meta refresh redirect.
i tried replacing the whole echo part with a header redirect and said it can't modify header info. can meta refresh be put in the body?
actually i figured it out, by making the user not even be able to get to the page where there are no more images
just make sure absolutely NOTHING is sent to the browser prior to the redirect. Meta refresh works in almost all cases, can be fast, and anything can be sent to the browser prior to redirect. Can also try a javascript redirect (document.location=....)
Well you could always send the headers BEFORE the echo, but put a 5 second delay on the headers and then the echo text will show up for 5 seconds before you are re-directed.