Afisare valoare variabila cu return in php
Scris: Dum Aug 13, 2017
Salutare,
Am urmatorul cod si nu imi afiseaza valoarea de la variabila $slct in browser
Am urmatorul cod si nu imi afiseaza valoarea de la variabila $slct in browser
Cod: Selectaţi tot
<?php
if(isset($_POST['btn'])){
$slct = $_POST['slct'];
return $slct;
}
?>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>test</title>
</head>
<body>
<form action="" method="post">
<select name="slct">
<option value="2016">2016</option>
<option value="2017">2017</option>
</select>
<input type="submit" name="btn" value="buton">
</form>
<div id="test"><?php echo $slct; ?></div>
</body>
</html>