shadiadiph Posted December 18, 2008 Share Posted December 18, 2008 I have a change password page i have been playing around with it works updating the password if if the original password was entered and returns to the page and if the wrong password goes back to the page but it isn't displaying the results sorry i am new to all this any help will be appreciated thanks. <? session_start(); error_reporting(7); require("../global/admin_functions.php"); $sid = $_SESSION['LOGINID']; if($sid!="") { $accountid = ($_POST["accountid"]); $password = ($_POST["password"]); $newpassword = ($_POST["newpassword"]); $sql = "select password from tbluserdetails where intAccountID=$sid"; $temps = $DB_site->query($sql); if($row=$DB_site->fetch_array($temps)) { if ($password == $row[password]) { $insertsql = "update tbluserdetails set password='$newpassword', dtupdated='now()' where intAccountID='$accountid'"; $DB_site->query($insertsql); header("Location:updatepw.php?accountid='$sid'&result='1'"); exit; } else { header("Location:updatepw.php?accountid='$sid'&result='2'"); exit; } } } ?> here is the table i have put on the next page to get the result for example the url header when it jumps back to the page reads http://asiapacificsolutions.net/hmt/user/myaccount/updatepw.php?accountid='2'&result='2' <table> <? $result = $_GET['result']; if($result=="1") { ?> <tr> <td><font color="#FF0000">Old Password Mismatched</font> </td> </tr> <? } elseif($result=="2") { ?> <tr> <td><font color="#007bcb">Password Successfully Updated</font> </td> </tr> <? } ?> </table> Quote Link to comment https://forums.phpfreaks.com/topic/137545-_get-result-not-working/ Share on other sites More sharing options...
.josh Posted December 18, 2008 Share Posted December 18, 2008 variables sent through the url are accessed from $_GET['varnamehere'] not $varnamehere Quote Link to comment https://forums.phpfreaks.com/topic/137545-_get-result-not-working/#findComment-718845 Share on other sites More sharing options...
shadiadiph Posted December 18, 2008 Author Share Posted December 18, 2008 it is saying $_GET['result'] not $_GET['$result'] already sorry i am totally lost here don't get the answer sorry Quote Link to comment https://forums.phpfreaks.com/topic/137545-_get-result-not-working/#findComment-718872 Share on other sites More sharing options...
.josh Posted December 18, 2008 Share Posted December 18, 2008 In your first page you check if prev password matches and if it does, it updates table to new password, but then sends result as 1, which displays the password mismatched message. You send the password updated successfully message only if $sid == "" Quote Link to comment https://forums.phpfreaks.com/topic/137545-_get-result-not-working/#findComment-718877 Share on other sites More sharing options...
shadiadiph Posted December 18, 2008 Author Share Posted December 18, 2008 i justy changed that it wasn't displaying anything before no messages i got it working now thanks for the input Quote Link to comment https://forums.phpfreaks.com/topic/137545-_get-result-not-working/#findComment-718881 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.