Exclude or Ignore an include

1

Good evening, I'm doing a project where I should consult and then modify some data, but I have the following situation:

  • I have the Query of the query and after that, an include where I store the form in which the data will be displayed.
  • But when consulting to modify, the previous include does not work and I would like to ignore it and then add another one.
  • The question is: Is there a way to do that? or should I copy and paste the code and append the new include?

    As you will see in the image, that include is the one that serves me for the format of the query, but it does not work for the modification format, but since the query code is the same, can I exclude that include or should I? Copy everything back into another file?

        
    asked by shadowmors 22.12.2016 в 03:48
    source

    1 answer

    2

    You need to have a way to identify the type of query and I guess it comes in a POST or something like that, then you need to do the following:

    if($_POST['tipo_consulta'] == 'consulta'){
      include_once "casoConstanciaAlumno.php";
    }else{
      include_once "casoInversoPersonaAjena.php";
    }
    

    Do not forget to escape your inputs before using them in the code!

        
    answered by 22.12.2016 в 08:16