include function inside an isset function

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • backups2007
    New Member
    • Jul 2007
    • 92

    #1

    include function inside an isset function

    is it possible to use an include function inside an isset function?

    something like:

    [php]
    if(isset($_POST['submit']))
    {
    include("insert .php");
    }
    [/php]
  • pbmods
    Recognized Expert Expert
    • Apr 2007
    • 5821

    #2
    Heya, Backups.

    Yup. In fact, just like you have there; a call to include() inside of a conditional block.

    Comment

    • backups2007
      New Member
      • Jul 2007
      • 92

      #3
      What if the input type that I use is button instead of submit, will the isset function work?

      Comment

      • Markus
        Recognized Expert Expert
        • Jun 2007
        • 6092

        #4
        Originally posted by backups2007
        What if the input type that I use is button instead of submit, will the isset function work?
        Nope. It is not good practice to check whether the form is submitted through the the 'submit' button because, as we know, there are many other ways of submitting a form.

        Iff you're going to use a regular type=button ( i shall assume you're doing some sort of validation before submitting ) you should check for some other element and see if that is selected. eg. a 'terms and condition' select box.

        Comment

        • backups2007
          New Member
          • Jul 2007
          • 92

          #5
          what shoulf i use then? i need to use two buttons with different actions. could i use the if(isset()) condition? and what input type should i use?

          Comment

          Working...