SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Zealot zeeshan's Avatar
    Join Date
    Mar 2001
    Posts
    123
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Aarrgh! I can't figure this out!

    Guys I've been trying to solve this problem for the past two days without any luck. (See Code below)

    Everytime I submit the page, it comes back saying "Password missing", and doesn't pick up the $pass variable from the form for my SQL query! (If I hardcode the password into the query it works fine).

    Please help with this if you can. Thanks!

    p.s. Basically, I have username and password fields. Upon submission, the SQL query is executed. Am I even doing this the correct way, or is there another way around this? Thanks a lot!

    <?
    $conn = new DataBase($dbname,$server,$login,$passwd);
    if ($update):
    $query = "SELECT * FROM TEMPREG WHERE username='$alias' AND password='$pass'";
    @$conn ->Query($query);
    if ($conn -> Get_Total_Record () ):
    $error = FALSE ;
    $info=$conn->Get_Record_Item("values");

    // Do some cool stuff here

    $successful = 1;

    if (!$conn ->Add_Record("USER",$values[0]) )
    $successful = 0;

    //Some cool stuff here
    if(!$conn->Add_Record("USERSHOPONLINE",$vl))
    $successful = 0;
    endfor;

    if ($successful):

    endif;

    else :
    Show_Error_Msg("Error in registration.");
    endif;
    else :
    $error = TRUE;
    endif;

    endif;

    if (!$alias OR $error OR !$pass):

    ?>
    <FORM method="POST" name="form" action="<?print $PHP_SELF?>">
    <INPUT TYPE=HIDDEN NAME="update" value=1>

    <TABLE width="100%" border="0" cellspacing="0" cellpadding="2" bgcolor="#FFFFFF">


    <TR><TD class="Ysmall" width="28%">Nickname: </TD>
    <TD width="30%" class="Small">
    <p>
    <INPUT type="text" name="alias" maxlength="12" size="12" value="<?echo $alias?>">
    </p>
    <p>
    password:
    <input type="text" name="pass" maxlength="12" size="12" value="<?echo $pass?>">
    </p>
    </TD>
    <TD class="SmallDescribe">
    <?
    if ($update AND !$alias)
    print "Nickname missing";
    elseif ($update AND !$pass)
    print "Password missing";
    elseif ($error)
    print "ERROR!";
    else
    print "&nbsp";

    ?>
    </TD>
    </TR>

    <TR>
    <TD colspan="3">
    </TD>
    </TR>
    <tr>
    <tr><td colspan=3>
    <input type="image" border="0" name="Search" src="images/sub/send.gif" width="81" height="20" align="right">
    </td></tr>
    </TABLE>
    </FORM>
    </BODY>
    </HTML>
    <?
    else:

    ?>
    <br>Thanks for logging in!<br>
    <? endif;
    include("bottom.php");
    ?>

  2. #2
    We like music. weirdbeardmt's Avatar
    Join Date
    May 2001
    Location
    Channel Islands Girth: Footlong
    Posts
    5,882
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Code:
    <INPUT TYPE=HIDDEN NAME="update" value=1>
    try taking out "value=1" -- if the form has been submitted, then the variable will automatically be set -- no need for it.
    I swear to drunk I'm not God.
    Matt's debating is not a crime
    Hint: Don't buy a stupid dwarf Clicky

  3. #3
    SitePoint Wizard Defender1's Avatar
    Join Date
    Apr 2001
    Location
    My Computer
    Posts
    2,808
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    well, there is if he needs to use that 1
    Defender's Designs
    I'm Getting Married!

    Not-so-patiently awaiting Harry Potter Book 7 *sigh*


Bookmarks

Posting Permissions

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