php - Echo Warning or Confirmation on Condition -
I expect execution:
function email ()
each Bar page is said to be loaded. If $ Valid
is present email ()
should either return correct or false . If $ Valid
is not present then email ()
check postback ()
(example: the page has been submitted and we are looking for it Are the other times?) And if correct is valid field ()
s form and either set $ valid = 1
( true ) and Mail ()
or set to $ valid = 0
( false ).
Now exists $ valid
to call email ()
for the second time, for example say correct Or false should be returned
what's happening
$ valid Code> does not appear when this happens when
email ()
is initially called when we call email ()
for the second time Isset ($ valid) is called
if
section always false returns
I really hope you can help, I appreciate any answers and thank you all!
BTW: I know we can " try
" and " hold
" mail ()
but I The more you can do, the more complexity of the code is reduced, it is easier to digest!
Here is the code with which I need help:
Validate the function (if (! (Empty ($ _ POST ["" "]) & amp; Amp ;; Empty ($ _ POST ["body"]) {back true;} other {return false;};}; function postback (if {isset ($ _ POST ["Return"]) ;} Other {return false;};}; function email () {if (isset (valid $)) {if ($ Valid! = 0) {true;} Other {return false;};} Else {if (Postback ()) {If (valid ()) {$ Valid = 1;} and {$ Valid = 0;};}}}}}}; Email ();
You have to declare $ valid
as static If you want the values to be saved in the function calls, for example:
function (email) (static $ Valid = null; if ($ valid! == zero) { If ($ Valid! = 0) {Back true;} Other {return false;};} Other {// etc.}}
View:
Meditation Assume that the price will not be preserved on HTTP requests, if you need to process data in a session. / P>
Comments
Post a Comment