rallokkcaz Posted April 24, 2007 Share Posted April 24, 2007 ok i have an update profile form that works great there is no errors but it won't submit the form and update the data base can anyone help?? here is the code: <?php session_start(); //include config.php file include('../config.php'); ?> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <style> .words { background-color:#16333B; color:#A9D033; } </style> <?php $p=$_GET['p']; //see my ?id= browsing tutorial switch($p){ default: //if user isn't logged in lets show him the log in form if(!isset($_SESSION['username'])){ ?> <form action='login.php' method='POST'> You Must Be logged in to View this page!<br> Login here:<br> Username: <input type='text' name='username' class='words'><br> Password: <input type='password' name='password' class='words'><br> <input name='login' type='submit' value='Submit' class='words'><br> Not <a href="register.php">registered</a>? </form> <?} else{ //$_SESSION['username'] = the current users //username. It will be echoed like "Hi, user!" $id = $_SESSION['id']; $sql = "SELECT * FROM users WHERE id='$id'"; $result = @mysql_query($sql) or die(mysql_error()); echo <<<HTMLFORM <form action="{$_SERVER['PHP_SELF']}" method="post"> <table cellpadding="2" cellspacing="1" width="400"> <tr> <td wdith="35%">Username:</td> <td>{$_SESSION['username']}</td> </tr> <tr> <td>Full Name:</td> <td><input type="text" name="fullname" value="{$user['']}" /></td> </tr><tr> <td>Password</td> <td> New Password: <input type="password" name="password" value="$password" /></td> </tr> <tr> <td>About Me:</td> <td><textarea height="200px" width="300px" input type="text/html" name="about" value="" />{$_SESSION['aboutme']}</textarea></td> </tr><tr <tr> <td>Email Address:</td> <td><input type="text" name="email" value="" /></td> </tr> <tr> <td colspan="2"> <input type="hidden" name="id" value="{$_SESSION['id']}" /> <input type="submit" name="update" value="Update Profile"> </td> </tr> </table> </form> HTMLFORM; } } ?> Link to comment https://forums.phpfreaks.com/topic/48536-how-to-submit-a-update-profile-form/ Share on other sites More sharing options...
rallokkcaz Posted April 25, 2007 Author Share Posted April 25, 2007 anyone ? Link to comment https://forums.phpfreaks.com/topic/48536-how-to-submit-a-update-profile-form/#findComment-237594 Share on other sites More sharing options...
otuatail Posted April 25, 2007 Share Posted April 25, 2007 Personaly I don't like echo ing html. I would revert back to html and insert the data where needed. What database are you atempting to update. You are resubmitting the form back to itself. post to an update php file and re-direct back retreaving the databse data. Can't find any Insert into or update table here Link to comment https://forums.phpfreaks.com/topic/48536-how-to-submit-a-update-profile-form/#findComment-237612 Share on other sites More sharing options...
rallokkcaz Posted April 25, 2007 Author Share Posted April 25, 2007 so what exactly should i do to do that Link to comment https://forums.phpfreaks.com/topic/48536-how-to-submit-a-update-profile-form/#findComment-237754 Share on other sites More sharing options...
rallokkcaz Posted April 25, 2007 Author Share Posted April 25, 2007 does any one have any idea what im doing wrong i can tell me in a way i understand because im a noob at this form submit stuff Link to comment https://forums.phpfreaks.com/topic/48536-how-to-submit-a-update-profile-form/#findComment-237776 Share on other sites More sharing options...
The_eXXe Posted April 25, 2007 Share Posted April 25, 2007 I am really sleepy, if it is an update from database, I can not see any sql querry string starting like UPDATE <tablename> SET blabla... Link to comment https://forums.phpfreaks.com/topic/48536-how-to-submit-a-update-profile-form/#findComment-237807 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.