Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Redirect Giving Odd Errors

Status
Not open for further replies.

mtorbin

Technical User
Nov 5, 2002
369
US
Hey all,

I'm new to PHP, but I've been coding JS, Perl and ASP for a quite a bit so I'm used to the syntax. However, I can't figure out the following issues. I get this error:

Code:
Warning: Cannot add header information - headers already sent by (output started at /var/[URL unfurl="true"]www/html/handle_form02.php:6)[/URL] in /var/[URL unfurl="true"]www/html/handle_form02.php[/URL] on line 28

from this script:

Code:
<html>
 <head>
 
 </head>
 <body>
  <?php
   // Create a shorthand for the form data.
   $partNo = $_REQUEST['partNumber'];
   $ipAddr = $_SERVER['REMOTE_ADDR'];
   
   $today = getdate();
   $currentSeconds = $today['seconds'];
   $currentMinutes = $today['minutes'];
   $currentHour = $today['hours'];
   $currentDate = $today['mday'];
   $currentDay = $today['weekday'];
   $currentMonth = $today['month'];
   $currentYear = $today['year'];
   $timeStamp = $currentDay . ', ' . $currentMonth . ' ' . $currentDate . ', ' . $currentYear . "\t" . $currentHour . ':' . $currentMinutes . ':' . $currentSeconds;
   
   $writeString = "<tr><td>$partNo</td><td>$ipAddr</td><td>$timeStamp</td></tr>\n";
   
   $filename = '/var/[URL unfurl="true"]www/partNoSearchIPs.txt';[/URL]
   $fp = fopen($filename, "a"); // open for writing only and place the cursor at the end of the file
   $write = fputs($fp, $writeString);
   fclose($fp); 
   
   header('Location: [URL unfurl="true"]http://www.newpage.com/');[/URL]
   exit;
  ?>
 </body>
</html>

Any help would be much appreciated.

- MT
 
Fixed it... I'll post the final code in a moment.

- MT
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top