Je suis un debutant en php puisque ça fait maintenant 2 ans que je n'ai pas encore faite du php. Bref, mon problème s'est que je veux qu'un code php s'execute lorsqu'on va cliquer dans un div html & je ne sais pas comment faire.
Mon code :
<?php
if(empty($_COOKIE['fondo']))
{
$_COOKIE['fondo'] = 'blanco';
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="fr">
<head>
<title>Color</title>
</head>
<style type="text/css">
div
{
width:25px;
height:25px;
border:1px solid black;
}
#negro
{
background-color:black;
}
#blanco
{
background-color:white;
}
#rojo
{
background-color:red;
}
#verde
{
background-color:green;
}
#azul
{
background-color:blue;
}
#armillo
{
background-color:yellow;
}
#rosa
{
background-color:pink;
}
#gris
{
background-color:grey;
}
#naranja
{
background-color:orange;
}
#marron
{
background-color:brown;
}
#malva
{
background-color:purple;
}
</style>
<body>
<div id="blanco"></div><br>
<div id="negro"></div><br>
<div id="gris"></div><br>
<div id="rojo"></div><br>
<div id="verde"></div><br>
<div id="azul"></div><br>
<div id="malva"></div><br>
<div id="naranja"></div><br>
<div id="armillo"></div><br>
<div id="marron"></div><br>
<div id="rosa"></div><br>
<?php echo $_COOKIE['fondo'] ?>
</body>
</html>