PHP Reload Current Page On Form Submit -


i have form on page submit comment, , once user places comment reload page.

this got

      $insertgoto = "employer.php?employer=" . $row_employer_page['employer'] . "";   if (isset($_server['query_string'])) {     $insertgoto .= (strpos($insertgoto, '?')) ? "&" : "?";     $insertgoto .= $_server['query_string'];   }   header(sprintf("location: %s", $insertgoto)); } 

it works, got error on submit.

    notice: undefined variable: row_employer_page in /u/students/m/*******/public_html/cis231/project/employer.php on line 51  warning: cannot modify header information - headers sent (output started @ /u/students/m/*******/public_html/cis231/project/employer.php:51) in /u/students/m/*******/public_html/cis231/project/employer.php on line 56 

the lines references code posted above. i'm not sure what's going on, reload page how want throws error

you can not send headers once you've echoed content (at line 56). header function. may want use template engine though , echo compiled template @ end of file.

another solution capture output http://php.net/manual/de/function.ob-start.php , flush afterwards.


Comments

Popular posts from this blog

java - Jmockit String final length method mocking Issue -

asp.net - Razor Page Hosted on IIS 6 Fails Every Morning -

c++ - wxwidget compiling on windows command prompt -