Ciao.
Non ho letto tutto il tuo codice ma da quel che vedo hai probabilmente le idee poco chiare.
Per passare una variabile da una pagina ad un'altra con un form basta fare:
<form method="post" action="nuova.pagina.php">
<input type="text" name="pippo" value="pluto"/>
<input type="submit" name="ok" value="invia" />
</form>
ed in nuova.pagina.php lo richiami con
<?php
echo $_POST['pippo'];
?>