Your three lines of code will always put $var2 in $var3, as far as your $var1 is just declared as empty before.
In your html script, where do you want to show the result ? If its in the input, you have to echo $var3 instead of $var1.
solved Set default query by var1 & var2