I'm trying to make a page on php that dynamically insert some events from my sql database, the problem is, when i put it on a HTML, i can't post the id that i have clicked.
Or it means, when i click on a entire div i need to post it whit the id of an input type hidden...
Any tips?
Here is my code:
<?php
if($_POST){
    $sql = mysql_query("SELECT * FROM evento");
    while ($evento = mysql_fetch_object($sql)) {
        if($_POST["id".$evento->id_evento] == $evento->id_evento){
            echo "oi";
        }
    }
}else{
    $sql = mysql_query("SELECT * FROM evento");
    while ($evento = mysql_fetch_object($sql)) {
        echo "<form action='eventos' method='POST'>
                <input type='hidden' name='id' value='".$evento->id_evento."'/>
                <div onclick='javascript: this.submit();' id='id' class='col-md-4' >
                    <div style='white-space: nowrap;text-align: center;min-height:190px'>
                        <span style='display: inline-block;height: 100%;vertical-align: middle;'></span><img src='".$root."img/upload/eventos/".$evento->img."' style='width:100%; max-height:200px; vertical-align: middle;'>
                    </div>
                    <p style='color:#00AEC3;background:#F2F2F4;padding:10px 5px'>" . $evento->titulo . "<br> <span style='color:black'>".date('d/m/Y', strtotime($evento->data_inicio))." à ".date('d/m/Y', strtotime($evento->data_fim))."</span></p>
                </div>
            </form>";
    }  
}
?>
 
    