how to fix Fatal error: Uncaught Error: Undefined constant “q” in C:xampphtdocs1web.php:15 Stack trace: #0 {main} thrown in C:xampphtdocs1

i am trying to make the php website to work
but it tell me Warning: Undefined variable $q in C:xampphtdocs1amyweb2.php on line 27

<?php
echo "hello"."<br>"."this is the website"."<br>"."<br>"
?>
<html>
<body>
  <form action="myweb.py" method="POST">
    what is your name: <input type="text" name="q"><br><br>
    what is your emall: <input type="text" name="w"><br>
    <input type="submit"> 
  </form>
</body>
</html>

<?php
$fp = fopen('q.txt', 'w');
if ($fp === false) {
    echo "Error opening the file";
} else {
    fwrite($fp, $q);
    fclose($fp);
}
?>

i tried to make $q = none in the start so win i type an input it change before it write the txt file but
it didn’t work