Re: if/else statement, form-check



David Haynes wrote:

I don't see how 'if (!email || !phone) redirect;'
handles this case:

"if there is no email present, I want it to check if there is a
phonenumber entered, and if _both_ those conditions are false,
then I want to redirect."

The || would say that you will redirect if *either* email or phone is not set.

Yes, indeed. I guess I misinterpreted. Or maybe not. The original post said:

"Today I check for the existence of an email-address, and a validation code - what I need is a way to check, eg. whether email _or_ phone is entered, and if none is entered, display an errorpage."

So if you take it that both email and phone must be present and valid, then "&&", if you take it that either of the email or phone must be valid, then its "||". In either case, the rest of it is the same.

/m
.



Relevant Pages

  • RE: Frame for Response.Driect or Server.Transfer
    ... if the result of your server side code ... > frames to other pages. ... >> code and then redirect the user somewhere else. ... >> Response.Redirect or Server.Transfer what frame to display the page in or ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: [PHP] Redirect via GET is loosing characters
    ... RURL = Remote URL. ... As the GET method, which the redirect is ... display what you want to display. ... PHP General Mailing List ...
    (php.general)
  • Frustrations with Error Logging
    ... EmailErrorMessage was true, it would send an email with the error ... If DisplayErrorMessage was true, ... the error object is lost. ... this point, but when I redirect to the error page, I lose the ability ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: Frustrations with Error Logging
    ... public class WebPageExceptionWrapper ... If DisplayErrorMessage was true, ... have access to the error object as this is effectively a redirect, ... the error object is lost. ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: .NET forms authentication role-based redirection?
    ... I would consider using a Login View control. ... means of a redirect (maybe examine the Response object to determine this. ... If the page is NOT a redirect you could display some ... I think a View control would probably work easiest. ...
    (microsoft.public.dotnet.framework.aspnet)