As they say in the comments, onclick is a JavaScript event, and therefore, it seeks to execute JavaScript code.
PHP is a language that works from the server side . Functions in PHP are evaluated before displaying your page on the screen, and they are what generate the HTML.
For example, when you put:
<td><a href="#" onclick="<?php $estadoA = $estado3;?>"><?php $ASIENTO = 11; echo $estadoA;?></td>
This should be translated into HTML:
<td><a href="#" onclick="">Contenido de estadoA</a></td>
Because before assigning the page, assign the value of estado3
to estadoA
, value 11 to asiento
, and finally make echo
of the value of estadoA
, which is the only thing you will see in the HTML.
JavaScript on the other hand, run from the client side . That's why you can detect events like onclick
, and execute code without refreshing the page.
Unlike PHP code, the JavaScript code is in the browser and runs there. The user can see and modify this code, so for issues that require security, PHP or another language that works on the server side is used.
I can not answer what should go inside your onclick
, since it is not clear to me what you want to achieve with the code, but I hope that this differentiation will help you to continue learning.