Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 7 of 7
  1. #1
    Regular Coder Deacon Frost's Avatar
    Join Date
    Feb 2008
    Location
    Between the Lines
    Posts
    279
    Thanks
    31
    Thanked 4 Times in 4 Posts

    else...else...if

    Hey guys, long time no see. I stopped programming for a couple of months, and now I'm really fuzzy and can't even fix up a nice password change form O.o. Anyways, I'm having issues setting it up, here's my current code, and my issue at the bottom...


    PHP Code:
    <?

    $url 
    $_GET['$password'];
    $oldpass $_GET["oldpassword"];
    $newpass $_POST["newpassword"];
    $newpass2 $_POST["newpassword2"];

    if(isset(
    $password) && isset($newpass))
    {
    echo 
    "".$oldpass.",".$newpass.",".$newpass2.".";
    }

    ?>

    <?

    elseif(isset($password) && !isset($newpass))

    {
    ?>

    <form action="?password=<? echo $newpass ?>" method="post" ?>
    Please enter your old password:<br /> <input type="password" name="oldpassword" /><br /><br />
    Please enter your new password:<br /> <input type="password" name="newpassword" /><br /><br />
    Please confirm your new password:</br /> <input type="password" name="newpassword2" /><br /><br />
    <input type="submit" value="Change Password">
    </form>

    <?
    }

    else
    {
    ?>
      <div id="content">
        <h2><a href"?password=">Change Password</a></h2>

    <?
    }
    ?>
    E: Oh Yeah:

    My Error = Parse error: syntax error, unexpected T_ELSEIF in accoptions.php on line 21



    Now, what I want, it should display the Change Password thing at the bottom (The 'Else' option) if every other criteria is not met. If you have clicked it, it should display the elseif option, and if you have changed everything, it should echo just the data (I haven't attached the database to it yet, so it's not updating).


    Thanks in advance .
    Last edited by Deacon Frost; 05-15-2008 at 06:42 AM.

  • #2
    Supreme Master coder! abduraooft's Avatar
    Join Date
    Mar 2007
    Location
    N/A
    Posts
    14,861
    Thanks
    160
    Thanked 2,223 Times in 2,210 Posts
    Blog Entries
    1
    if(isset($password) && isset($newpass))
    {
    echo "".$oldpass.",".$newpass.",".$newpass2.".";
    }

    ?>

    <?

    elseif(isset($password) && !isset($newpass))

    {
    Hmm.. there is an independent block inside the first if and elseif, which is not allowed.

    However the following should work!
    Code:
    if(isset($password) && isset($newpass))
    {
    echo "".$oldpass.",".$newpass.",".$newpass2.".";
    
    
    ?>
    
    <?
    }
    elseif(isset($password) && !isset($newpass))
    
    {
    The Dream is not what you see in sleep; Dream is the thing which doesn't let you sleep. --(Dr. APJ. Abdul Kalam)

  • #3
    Regular Coder Deacon Frost's Avatar
    Join Date
    Feb 2008
    Location
    Between the Lines
    Posts
    279
    Thanks
    31
    Thanked 4 Times in 4 Posts
    Nope, no such luck.


    http://downstage.tv/accoptions.php


    It got rid of the error, now it just won't read it?

    Checking out what that's all about, but still having issues :P.

  • #4
    Supreme Master coder! abduraooft's Avatar
    Join Date
    Mar 2007
    Location
    N/A
    Posts
    14,861
    Thanks
    160
    Thanked 2,223 Times in 2,210 Posts
    Blog Entries
    1
    OK, but what's this
    Code:
    if(isset($password) && isset($newpass))
    The Dream is not what you see in sleep; Dream is the thing which doesn't let you sleep. --(Dr. APJ. Abdul Kalam)

  • #5
    Regular Coder Deacon Frost's Avatar
    Join Date
    Feb 2008
    Location
    Between the Lines
    Posts
    279
    Thanks
    31
    Thanked 4 Times in 4 Posts
    Oh, I didn't see that. It was off, but didn't fix the issue.

    PHP Code:
    <? 

    $url 
    $_GET["password"]; 
    $oldpass $_GET["oldpassword"]; 
    $newpass $_POST["newpassword"]; 
    $newpass2 $_POST["newpassword2"]; 

    if(isset(
    $url) && isset($newpass))
    {
    echo 
    "".$oldpass.",".$newpass.",".$newpass2.".";

    }
    elseif(isset(
    $url) && !isset($newpass))

    {
    ?> 

    <form action="?password=<? echo $newpass ?>" method="post" ?> 
    Please enter your old password:<br /> <input type="password" name="oldpassword" /><br /><br /> 
    Please enter your new password:<br /> <input type="password" name="newpassword" /><br /><br /> 
    Please confirm your new password:</br /> <input type="password" name="newpassword2" /><br /><br /> 
    <input type="submit" value="Change Password"> 
    </form> 

    <? 


    else 

    ?> 
        <h2><a href"?password=">Change Password</a></h2> 

    <? 

    ?>
    Is the edited code.

  • #6
    Supreme Master coder! abduraooft's Avatar
    Join Date
    Mar 2007
    Location
    N/A
    Posts
    14,861
    Thanks
    160
    Thanked 2,223 Times in 2,210 Posts
    Blog Entries
    1
    Are you trying to display a form in that page by the above code?
    I don't think the above code is enough for that.
    If if(isset($url) && isset($newpass)) is false, then
    Code:
    elseif(isset($url) && !isset($newpass))
    also be false.

    And what's this
    <a href"?password=">Change Password</a>
    ?
    Firebug shows it like
    Code:
    <a footer="" ?password=">Change Password</a>
    The Dream is not what you see in sleep; Dream is the thing which doesn't let you sleep. --(Dr. APJ. Abdul Kalam)

  • Users who have thanked abduraooft for this post:

    Deacon Frost (05-15-2008)

  • #7
    Regular Coder Deacon Frost's Avatar
    Join Date
    Feb 2008
    Location
    Between the Lines
    Posts
    279
    Thanks
    31
    Thanked 4 Times in 4 Posts
    I want it to display a link to click to change the page to a form to change the page to the data entered in the form.

    E: It sucks with things are so simple. Hence why we code during day time, and not at 2a.m..


    Thanks man! Got it fixed now, and tweaked it. I think I'm back in the groove, sometimes it just takes an outside input.
    Last edited by Deacon Frost; 05-15-2008 at 09:01 AM.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •