Jump to content

PHP POST Question


harshpandya

Recommended Posts

Here is my some code:if ($_SERVER["REQUEST_METHOD"] == "POST") {.......}<form action="<?= $postUri ?>" method="post" onSubmit="return verifyInput();" onReset="setFormDisabled(true);">......</form>Q1))) I am passing some input variables to the PHP page itself. I am using POST method. When i hit submit, the page loads all values are saved but page does not show me new values on the page. I have to refresh the page. Why????? ANy solution to refresh without delay beside using header??Q2))) I tried header(Location: url);, it gives me the error saying that headers already sent by (output> started at d:\wwwroot\b2b\cart.php3:9) , I look it up the error it says you are trying to put some output before your session starts. But i could not find any output like echo or printf.PHP runs everytime you load the Page, In the above case, when page loads all php runs but the above one because its checking for POST request. So untill i submit this php code will not run. Please answer my 2 questions ...Thanks,

Link to comment
Share on other sites

Output doesn't need to be given with an echo statement.Just by having content (even a line break or space) before the <?php tag will give output.

Hello<?php header("Location: next.php"); ?>

Is outputting the word "Hello" and a line break before running any PHP.

Link to comment
Share on other sites

Q1))) I am passing some input variables to the PHP page itself. I am using POST method. When i hit submit, the page loads all values are saved but page does not show me new values on the page. I have to refresh the page. Why????? ANy solution to refresh without delay beside using header??
You have to process the form before you retrieve the (updated) information.
Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...