Get div value

1

I want to get the value of div when I click. The problem is that it creates a div in foreach . I want to get id , then pass this value to another page and use it to do a SELECT in the SQLite database.

$array_resultadoss = array(); //array   
$array_resultadoss=select($dir, $base, $i);
$titless = ""; //variable inicialize 

foreach($array_resultadoss as $key =>$value){
    $titless .= "<div class=dois>".$value['id']."</div>";//save in variable value
}

echo" 
    <td class='td_today'>
        <div class=divday style='cursor:pointer' onclick='popup(\"_popup_cal.php?jour=$i&moisEcris=$months[$moisaff]&annee=$year&mois=$month&txttitle=$txttitle&txtstart=$txtstart&txtend=$txtend&txtdescription=$txtdescription&maj=$maj&clean=1&numevent=$numevent\",400,300)';>
        ".$titless."</div>
    </td>";
}      
    
asked by anonymous 24.11.2014 / 15:05

1 answer

2

First, I advise you to refactor your code, the logic is not legal. But keeping what you already did, I believe the way to get what you expect is by generating the popup() function of Javascript for each <div> . I made the settings in the code and it looks like this:

$array_resultadoss = array();
$array_resultadoss = select($dir, $base, $i);
$titless = '';

foreach ($array_resultadoss as $key => $value) {
    $titless .= "<div class=dois onclick='popup(\"_popup_cal.php?jour=$i&moisEcris=$months[$moisaff]&annee=$year&mois=$month&txttitle=$txttitle&txtstart=$txtstart&txtend=$txtend&txtdescription=$txtdescription&maj=$maj&clean=1&numevent=$numevent&num_div={$value['id']}\",400,300)';>" . $value['id'] . '</div>';
}

echo "<td class='td_today'>
          <div class=divday style='cursor:pointer'>
              " . $titless . "
          </div>
      </td>";

Then in _popup_cal.php you will have $_GET['num_div']

    
24.11.2014 / 15:34