I have div with foreaches inside of it and my goal is to make an button to copy all the output in de div
code:
if(isset($_GET['bestellijst']))
{
?><div class="bestellijst"><?
foreach ($lijst['palen'] as $key => $value)
{
?><? echo $value ?>x paal <? echo "'" .$key. " cm'" ?><br><?
}?><br><?
foreach ($lijst['panelen'] as $key => $value)
{
?><? echo $value ?>x panelen <? echo "'" .$key. " cm'" ?><br><?
}
echo "<br>beugels: " . $allebeugels . "<br>";
?><button onclick="KopieerFuntie()">kopieer bestellijst</button>
</div><?
}
}
else{echo "<h4>Voeg een zijde toe</h4>";}
}
?><script>
function KopieerFunctie()
{
var copyText = document.getElementById("????");
copyText.select();
document.execCommand("copy");
alert("Copied the text: " + copyText.value);
}
</script><?
I don't know what to put in ????
Sorry if the code is messy im just a beginner.
Thanks for your help.