0

I want $con to be the selected value which is happening cause this echo '<p class="pop"></p>'; is working but I don't know how to put $con inside my query so it can give me the selected value there.

This is the error in the php script

Notice: Undefined index: evento in C:\xampp\htdocs\simulator\modulo1\error.php on line 2 Notice: Undefined index: evento in C:\xampp\htdocs\simulator\modulo1\error.php on line 201 Conferencia

but how it is possible if is printing the value conferencia that is coming from error.php? I don't get it

index.php

<script>
        $(document).ready(function () {
            $('#tipologias').change(function () {
                var con = $('#tipologias').val();
                console.log(con);

                $.ajax({
                    method: "post",
                    url: "error.php",
                    data: {evento:con}
                })
                .done(function(data){
                    $(".pop").html(data);
                });                
            });
        });
    </script>

<?php
    require_once 'error.php';    
    $con= $_POST['evento'];
    echo $con;
    echo '<p class="pop"></p>'; /* this work and print selected value without refreshing the page*/
    $query = $mysqli->query("SELECT requerimientos FROM tipologia where               tipologia=$con");
    $rows = $query->fetch_array(); 
?>
Jason Aller
  • 3,541
  • 28
  • 38
  • 38
Humano
  • 3
  • 2
  • 4
    only via [ajax](https://en.wikipedia.org/wiki/Ajax_(programming)) – Jeff Sep 30 '18 at 07:34
  • 1
    related: https://stackoverflow.com/questions/13840429/what-is-the-difference-between-client-side-and-server-side-programming – Jeff Sep 30 '18 at 07:36

0 Answers0