Echo My Form Values On Php
Am using the code below in order to print the values that am inserting on the boxes. However After I put the values and click submit nothing is printing out.
Solution 1:
This is never set:
if (isset($_POST["submit"])) {
Instead change it to:
if (count($_POST) > 0) {
You don't have any elements matching name="submit". Also, it is a bad practise to use isset($_POST["submit"]) as many of us, won't name it.
If you want to check for specific things set, like in your case, you need to do:
if (count($_POST) > 0 && isset($_POST["name"]) && isset($_POST['email'])) {
If still you wanna make your code work with the above set-up, kindly add a name and value here:
<inputtype="submit" name="submit" value="Submit" />
Solution 2:
There is no HTML element with the attribute name 'submit' exists.
Replace <input type="submit"> with <input type="submit" name="submit">.
Don't ever use isset($_POST['submit']) as it is considered to be a bad practice.
Instead you can use !empty($_POST). Doing it this way is considered to be safe.
Post a Comment for "Echo My Form Values On Php"