All TalkersCode Topics

Follow TalkersCode On Social Media

devloprr.com - A Social Media Network for developers Join Now ➔

Isset Submit In PHP

Last Updated : Mar 11, 2024

Isset Submit In PHP

In this tutorial we will show you the solution of isset submit in PHP, in last tutorial we understand about isset and why, where isset is used in php.

Today, we will continue our last article and understand about what is the use of isset in php forms in case of submit button.

Step By Step Guide On Isset Submit In PHP :-

Here, we know that isset is used to check whether a variable is settled or not.

Similarly, isset is used in forms to check is the form submitted successfully or not. We will have a better clarification after visualize the code given below.

<?php
if (isset($_POST['submit'])) {
 echo "Application submitted successfully";
}
?>
<!DOCTYPE html>
<html>
 <head>
  <title> isset submit in php </title>
 </head>
 <body>
  <form action = "next_page.php" method = "post">
   Name : <input type = "text" name = "name"
    placeholder = "What is your name?" />
   <br><br>
   Age : <input type = "number"
    name="age" placeholder="What your age"/>
   <br><br>
   <input type = "submit" name = "submit" value = "Submit">
  </form>
 </body>
</html>
  1. First, we write <! DOCTYPE html> which we used as an instruction to the web browser about what version of HTML file is written in.
  2. Secondly, the <html> tag is used to indicate the beginning of an HTML document.
  3. As above now <head> tag is used to contain information about web page. In this tag a <title> tag is used which helps us to specify a webpage title. Both <head> and <title> tags are Paired tags. So, both have </head> and </title> ending tags respectively.
  4. Here, then we create a body tag. All the content which we want to show on browser’s screen or display is always written inside this codes.
  5. As you see that inside body we create a simple form for inputting name and age. For this we use three inputs, first is for name, next one is for age and last is submit button which we create using input type=’submit’.
  6. And now we understand about php codes. As we want to know about isset and isset is a function of php that’s why we use php here.
  7. Inside php tags, we use isset using if statement. That why if our form is submitted successfully then we want to perform first function otherwise next function. For example, we want to save data into database on click on submit button, in that case we use isset there.
  8. Here, if our form submitted successfully then a message printed other nothing happens and page got refreshed. We can also use alert inside php here. We hope you understand the above codes easily.
  9. At last, the <body> and <html> tags are closed with </body> and </html> respectively.

Conclusion :-

At last in conclusion, here we can say that with the help of this article we are able to understand how to use isset in php in cast of submit.

I hope this tutorial on isset submit in PHP helps you and the steps and method mentioned above are easy to follow and implement.

Author Image About Anjali

Experienced Computer Programmer with a broad range of experience in technology. Strengths in application development and Object Oriented architecture design, front end programming, usability and multimedia technology. Expert in coding languages such as C, C++ Java, JavaScript, PHP and more.

Follow Anjali On Linkedin 🡪