I want to make my code change an element if that element's id matches the value of the button. as in:
if "button value" === "div id". I'm rusty on PHP though and don't know how to do it. The html looks a bit weird because its a sql injection site, though I'm pretty sure that shouldn't mess with anything.
Relevant PHP:
<?php
$ariabool="true";
$gridclass ="gridhidden";
if(isset($_POST['expand'])){
if(isset($_POST['expand'])==='id'){ //first pass of this, it doesn't work but i don't know how to do it properly
$gridclass = 'gridexpanded';
$ariabool = 'false';
}
}
?>
Relevant HTML
<div class='kagrid' >
<div class='griddisplay'>
<img src={$row['img']} />
<h2>{$row['name']}</h2>
<div>{$row['primpro']}</div>
<a href={$row['src']}>Image Source</a>
<button type='button' class='expand' name='expand' value={$row['id']}></button> //button i want to compare the value of
</div>
<div id={$row['id']} class='$gridclass' aria-hidden='$ariabool'> //element i want to compare the id of
<div class='gridcell bold'>Nicknames</div>
<div class='gridcell'>{$row['nicknames']}</div>
<div class='gridcell bold'>Pronouns</div>
<div class='gridcell'>{$row['pronouns']}</div>
<div class='gridcell bold'>Typical Age</div>
<div class='gridcell'>{$row['age']}</div>
<div class='gridcell bold'>Source(s)</div>
<div class='gridcell'>{$row['source']}</div>
<div class='gridcell bold'>Role(s)</div>
<div class='gridcell'>{$row['role']}</div>
<div class='gridcell bold'>Terms</div>
<div class='gridcell'>{$row['terms']}</div>
<div class='bold desc gridcell'>Description</div>
<div class='desc gridcell'>{$row['description']}</div>
</div>
</div>