johnseito Posted February 25, 2008 Share Posted February 25, 2008 If i input this code Code: header("Location: " . $_SERVER['PHP_SELF']); after this code Code: mysql_query("insert into upload3(photo, caption) values('$fileName','$caption')"); this code won't print Code: echo "<font color =red> The file </font><b>". basename( $_FILES['uploaded']['name']). "</b> <font color=red>has been uploaded to the</font>". "<b> $dir </b></font>"."<font color=red> directory.</font><br><br>"; Code: mysql_query("insert into upload3(photo, caption) values('$fileName','$caption')"); header("Location: " . $_SERVER['PHP_SELF']); echo "<font color =red> The file </font><b>". basename( $_FILES['uploaded']['name']). "</b> <font color=red>has been uploaded to the</font>". "<b> $dir </b></font>"."<font color=red> directory.</font><br><br>"; Do you know why or how I can fix it? thanks Quote Link to comment Share on other sites More sharing options...
Cagecrawler Posted February 25, 2008 Share Posted February 25, 2008 header("Location: " . $_SERVER['PHP_SELF']); The header("Location:.... function instantly redirects the script to the target location - anything after this point is ignored by the script and so will not be printed. If you want to show the text for a little while and then redirect, you should use the html <meta> tag. <?php echo "<META HTTP-EQUIV=\"Refresh\" CONTENT=\"5; URL=".$_SERVER['PHP_SELF']."\">"; ?> You need to put this into the <head> tag of your page though, so it might not be appropriate. Quote Link to comment Share on other sites More sharing options...
revraz Posted February 25, 2008 Share Posted February 25, 2008 If you search on what header is actually for, you'll understand why. Quote Link to comment 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.