Renlok Posted December 13, 2006 Share Posted December 13, 2006 ok ive made the most part of it work except for some reason it wont update the information cant figure out whyheres 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] Quote Link to comment Share on other sites More sharing options...
joquius Posted December 13, 2006 Share Posted December 13, 2006 you might want to put the strings in quotes. Also, just wondering, why is $id defined twice?and I hope $action is set somewhere... Quote Link to comment Share on other sites More sharing options...
simcoweb Posted December 13, 2006 Share Posted December 13, 2006 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'? Quote Link to comment Share on other sites More sharing options...
Renlok Posted December 13, 2006 Author Share Posted December 13, 2006 $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 reasonthe db connection in in the headerand 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"> </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"> </TD> <TD WIDTH="544"> <FONT FACE="Verdana,Helvetica,Arial" SIZE="2"> </FONT> <BR> <INPUT type="hidden" name="id" value="<? echo $id; ?>"> </TD> </TR> </TABLE> </FORM>[/code] Quote Link to comment Share on other sites More sharing options...
Renlok Posted December 15, 2006 Author Share Posted December 15, 2006 anyone got any ideas? ??? Quote Link to comment Share on other sites More sharing options...
Renlok Posted December 22, 2006 Author Share Posted December 22, 2006 nvm fixed it myself. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.