Jump to content

[SOLVED] account validation error


Renlok

Recommended Posts

ok ive made the most part of it work except for some reason it wont update the information cant figure out why

heres the code:
[code]
include "header.php";
$confirm = $_POST['confirm'];
$id = $_GET['id'];
if($action == activate)
{
    if($confirm == checkbox)
{
$id = $_POST['id'];
//-- User wants to confirm his/her registration
$query = "UPDATE a_users SET suspended=0 where id='$id'";
$res = mysql_query($query);
if(!$res)
{
$TPL_errmsg = $ERR_001;
$TPL_err = 1;
}

include "templates/template_confirmed_php.html";
}
else
{
echo 'You must confirm the activation before you can activate your account.<br>';
}
}
[/code]
Link to comment
Share on other sites

Honestly it's hard to tell with this limited snippet of code. For example, I don't see any database connection info. You have both a $_GET and a $_POST of the $id variable. I'm assuming you're getting the 'id' from the url to fill the $_GET which populates the checkbox name.. ? Then when they check the box it passes that 'id' on through the $_POST statement?  Also, IF they check the box then the query should run to update a specific field to an 'active' status. Is that field named 'suspended'?
Link to comment
Share on other sites

$confirm = $_POST['confirm'];
is taken off the form, confirm is a checkbox

$id = $_GET['id'];
this is taken from the url this is the users id

$id = $_POST['id'];
then i added this because it wasnt updating i thought i may not have id for some reason

the db connection in in the header

and if you the code for the from here it is
[code]
        <FORM NAME=registration ACTION="confirm.php?action=activate" METHOD="POST">
          <TABLE WIDTH="600" BORDER="0" CELLPADDING="5">
            <TR>
              <TD colspan="2" VALIGN="top" ALIGN="right"> <DIV align="left"><? print $std_font.$MSG_267; ?></DIV></TD>
            </TR>
            <TR>
              <TD WIDTH="130">&nbsp;</TD>
              <TD WIDTH="544">
                <? print $std_font.$MSG_368; ?>
                <BR> <input type="checkbox" name="confirm" value="checkbox">
                <? print $MSG_249; ?><br>
<?php $id = $GET['id']; ?>
<input type="hidden" name="id" value="<?php $id ?>">
                <BR> <INPUT TYPE=submit NAME=submit value='Activate Account'>
              </TD>
            </TR>
            <TR>
              <TD WIDTH="130">&nbsp;</TD>
              <TD WIDTH="544"> <FONT FACE="Verdana,Helvetica,Arial" SIZE="2">&nbsp;
                </FONT> <BR> <INPUT type="hidden" name="id" value="<? echo $id; ?>">
              </TD>
            </TR>
          </TABLE>
        </FORM>
[/code]
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.