Jump to content

how to submit a update profile form


rallokkcaz

Recommended Posts

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

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.