It's better if you read from page after displaying it in seperate "leave" function:
code:
;**********************************************************
;Mathematica Directory Page
Var MathDir
...
Page custom mathpage_show mathpage_leave
;********************************************************
;**********************************************************
;runs the function needed for the custom page
...
;shows custom page
Function mathpage_show
!insertmacro MUI_HEADER_TEXT "$(MATHLOCAL_TITLE)" "$(MATHLOCAL_SUBTITLE)"
;displays the custom page
!insertmacro MUI_INSTALLOPTIONS_DISPLAY "MathLocal"
FuncitonEnd
;gets the user entered values
Function mathpage_leave
!insertmacro MUI_INSTALLOPTIONS_READ $MathDir "MathLocal" "Field 1" "State"
FunctionEnd
;**********************************************************