change font on dropdown

change the font of an element from the font selected in the form select element.

HTML

<?php
$user_choice = $_POST['font_styles'];
if ($user_choice == "font_style_1"){
    $font = 'firstfont';
}elseif ($user_choice == "font_style_2"){
    $font = 'secondfont';
}elseif ($user_choice == "font_style_3"){
    $font = 'thiredfont';
}elseif ($user_choice == "font_style_4"){
    $font = 'forthfont';
}
?>
<html>
<head>
<style>
h1 {
font-family = $font;
}
</style>
</head>
<body>
    <form method='post'>
    <select name="font_styles">
    <option value="font_style_1">font_style_1</option>
    <option value="font_style_2">font_style_2</option>
    <option value="font_style_3">font_style_3</option>
    <option value="font_style_4">font_style_4</option>
    </select>
    <input type="submit">
    </form>
    <h1>username</h1>
 </body>
 </html>