Colourtheory Posted December 23, 2012 Share Posted December 23, 2012 No error is coming up, but it doesn't change the value. <?phprequire_once 'db.php';$page_mode = isset($_POST['page_mode']) ? $_POST['page_mode'] : ''; if ($page_mode == 'setbio'){ $id = $_SESSION['id'];$find = mysql_query("SELECT bio FROM users WHERE id='$id'");$bio = mysql_fetch_assoc($find);$biotext = $_GET['bio'];$update = db_query("UPDATE users SET bio='$biotext'WHERE id='$id'"); } ?><?php session_start(); if (isset($_SESSION['user_id'])){?><h1>Customize your profile, <?php echo "" . $_SESSION['user_name'] . "!"; ?><br><form action="myprofile.php" method="post"><input type="hidden" name="page_mode" value="setbio"><input type="text" text="Bio" name="bio"><br><input type="submit" name="submit"></form><?php} else{header('Location: login.php'); } ?> Link to comment Share on other sites More sharing options...
Colourtheory Posted December 23, 2012 Author Share Posted December 23, 2012 Maybe I should start over.. I think this script needs to be scrapped. Link to comment Share on other sites More sharing options...
kanchatchai Posted December 24, 2012 Share Posted December 24, 2012 (edited) may be$_SESSION['user_id'] not set Edited December 24, 2012 by kanchatchai Link to comment Share on other sites More sharing options...
thescientist Posted December 25, 2012 Share Posted December 25, 2012 (edited) what value are expecting to show up? What error reporting do you have turned on? if not set within php.ini, at the very least you should have this at the top of your script error_reporting(E_ALL);ini_set('display_errors', '1'); it looks like in the if condition that if you are expecting $_POST['page_mode'] to be set, and then $page_mode to be equal to 'setbio', you are also assuming $_SESSION[''id'] to be set without actually calling session_start(). Is this the use case you are experiencing? Edited December 25, 2012 by thescientist Link to comment Share on other sites More sharing options...
satishpoul Posted December 26, 2012 Share Posted December 26, 2012 at the start in php you are checking for $_POST['page_mode'] and if it is not set then ypur are assigning it as a value = ' ' (null/blank) instead of this i wold like suggest if(isset($_POST['$page_mode'])){ $page_mode == $_POST['$page_mode'];if ($page_mode == 'setbio'){ $id = $_SESSION['id'];$find = mysql_query("SELECT bio FROM users WHERE id='$id'");$bio = mysql_fetch_assoc($find);$biotext = $_GET['bio'];$update = db_query("UPDATE users SET bio='$biotext'WHERE id='$id'");}} and check your code by adding echo in each if as well as else loop.. you will get your answer. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now