mercredi 12 août 2020

undefined variable in a statement if else [duplicate]

I have a problem with my code in php inside a file html that's a variable inside a statement (if else) give me a notice that's not a undefined variable

that's the code

PHP CODE :

 <?php 
  if(isset($_POST['submit'])){
  
    $design = isset($_POST['design']) ? $_POST['design'] : NULL;
        
    if($design == 'normale'){
                $style = "<link rel='stylesheet' href = 'Styles/style2.css' />";
                }else{
                 $style = "<link rel='stylesheet' href ='Styles/style2.css' />";
                }                    
            //echo "<meta http-equiv='refresh' content='0'>";
                
    }

?>

HTML CODE:

<head>
    <title>Acceuil</title>
    <meta charset= "utf-8" />
    <?php
        echo $style;
    ?>
    
</head> 


 

the notice

Notice: Undefined variable: style in C:\xampp\htdocs\Openclassrooms\Espace Membre\index.php on line 27

Aucun commentaire:

Enregistrer un commentaire