Home  >  Article  >  Database  >  Why is My Echo and Table Not Displaying After Clicking the Submit Button?

Why is My Echo and Table Not Displaying After Clicking the Submit Button?

Linda Hamilton
Linda HamiltonOriginal
2024-11-06 20:35:02235browse

Why is My Echo and Table Not Displaying After Clicking the Submit Button?

Why if(isset($_POST['submit'])) Prevented Echo Display When Submit Button Clicked

When attempting to suppress echo and table display until the form's submit button is clicked using the if(isset($_POST['submit'])) function, issues arise. The echos and table remain concealed even when the submit button is clicked.

The error stems from the submit button's missing name attribute. Without a name, the $_POST['submit'] variable becomes inaccessible, preventing the if(isset($_POST['submit'])) function from executing properly.

Solution

To resolve this issue, assign a name to the submit button:

<p><input type="submit" value="Submit" name="submit" /></p>

With this modification, the if(isset($_POST['submit'])) function will function correctly, triggering the display of echos and the table when the submit button is pressed.

The above is the detailed content of Why is My Echo and Table Not Displaying After Clicking the Submit Button?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn