if statement

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Boujii
    New Member
    • Apr 2007
    • 5

    if statement

    I am trying to write an if statement like this:

    [PHP]
    $email = $_POST['email'];
    if ( "@" !isin '$email' ) {
    echo "Not a valid email address!<br />";
    return;
    }
    [/PHP]

    What i am trying to do is give message and return if @ is not in $email variable. I don't know the PHP equivelent for isin. Cannot use == because @ can be anywhere in the $email variable.
  • exoskeleton
    New Member
    • Sep 2006
    • 104

    #2
    good day sir...i have this simple code:

    [PHP]$mystring = 'a@bc';
    $findme = '@';
    $pos = strpos($mystrin g, $findme);

    if ($pos === false) {
    echo "The string '$findme' was not found in the string '$mystring' <br>";
    } else {
    echo "The string '$findme' was found in the string '$mystring'";
    echo " and exists at position $pos <br>";
    }[/PHP]

    you can modify this little code to fits your needs...
    hope it'l helps...more power :)

    Comment

    Working...