Is the HTML code before or after the header? As the header(); function
should be before any output is passed to the browser.

I advise you read about the header() function in the PHP manual.

----- Original Message -----
From: "rogue" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, December 11, 2003 2:34 PM
Subject: [PHP] Error that I can't find causing header() to fail


> Hi all,
>
> This template I have, has been driving me nuts. I am trying to debug
> someone else's code and have narrowed the problem down to a few lines,
> but I can't see what would be causing the problem.
>
> Here is the scoop. When this template loads it is making:
>
> header("Location: http://www.myurl.com";)
>
> Fail. If I remove the following hunk of code, everything works as it
> should on the template (redirecting me to the right place). Removing
> any ONE row or combination does not seem to fix it, so there is
> something to do with this whole block? I am at a loss here and could
> really use another pair of eyes.
>
> <snip>
>
>    <tr>
> <td nowrap align="right">
>   <b>Fax:</b>
> </td>
> <td>
>   <input name="fax" type="text" size="35" maxlength="20" value="<?php
> echo $fax; ?>">
> </td>
>    </tr>
>    <tr>
> <td nowrap align="right">
>   <b>Street:</b>
> </td>
> <td>
>   <input name="street1" type="text" size="35" maxlength="100"
> value="<?php echo $street1; ?>">
> </td>
>    </tr>
>    <tr>
> <td nowrap align="right">
>
> </td>
> <td>
>   <input name="street2" type="text" size="35" maxlength="100"
> value="<?php echo $street2; ?>">
> </td>
>    </tr>
>    <tr>
> <td nowrap align="right">
>   <b>City:</b>
> </td>
> <td>
>   <input name="city" type="text" maxlength="20"  value="<?php echo
> $city; ?>"> State:
>   <select name="state">
> <?php
>   mysql_select_db("main_db",$db) or die ("Unable to select database");
>   $sql = "SELECT * FROM states WHERE display='yes' ORDER BY state";
>   $result = mysql_query($sql,$db) or die ("Error in query: $sql".
> mysql_error());
>   while($stateNow = mysql_fetch_array($result)) {
> $state_name = $stateNow[state];
>
> print "<option value='$state_name'";
> if ($state_name == $state) {
>   print " SELECTED ";
> }
> elseif ($state_name == "NJ") {
>   print " SELECTED ";
> }
> print ">$state_name</option>\n";
>   }
> ?>
>   </select>
> </td>
>    </tr>
>
> </snip>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to