Note that there are some explanatory texts on larger screens.

plurals
  1. PODo I need to modify my Bluehost php.ini file? Header function not working on remote server
    primarykey
    data
    text
    <p>This block of code shown below using a php header redirect works locally, but not on my Bluehost server:</p> <pre><code>if ($_POST['submit']=='No') { $url ='Location: index.php?id='.$id.'&amp;page='.$page; header($url); exit; } </code></pre> <p>When the server gets to this block of code, absolutely nothing happens. No error, no warning, just a blank page. The page that my form submit redirects to isn't supposed to do anything except reroute the user to the relevant page. </p> <p>I'm pretty dang positive it has nothing to do with the common problem of including HTML before the redirect (since it works locally). Therefore I suspect it has something to do with differences between my php.ini files. I've pulled up PHPinfo() for both servers, and my local server has a module named mod_headers while my Bluehost server has none. I think this potentially could be the problem, although normally my Bluehost has no problems using header redirects, except in this one instance.</p> <p>So I suspect the problem has something to do with my ini file, but I don't know exactly what.</p> <p>What makes this problem even stranger is that there are other blocks of code which work just fine, for instance </p> <pre><code>if(!empty($_POST['id'])) { $id = htmlentities(strip_tags($_POST['id'])); $sql = "UPDATE entries SET title=?, entry=? WHERE id=? LIMIT 1"; $stmt = $db-&gt;prepare($sql); $stmt-&gt;execute(array($title,$entry,$id)); $stmt-&gt;closeCursor(); $url= 'Location: ../index.php?id='.$id.'&amp;page='.$page; header($url); exit; } </code></pre> <p>works just great.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload