View Full Version : ANy one help me plzzzzzzzz

06-05-2005, 12:57 PM
I m new for php world . I want to know when we updating the profile form like in orkut , it contains previous value what we filled ... how is this possible :confused: :confused: :confused:

06-05-2005, 01:00 PM
It gets the info from a database. Use a descriptive thread title next time too please :)

06-05-2005, 01:12 PM
Well firstly read this (http://www.codingforums.com/postguide.htm), particularly point 2.

As for the pre-filled values in the form, well that's pretty simple if you're pulling the data for the user out of a database you'd have a script something like:


$link = mysql_connect('localhost', 'mysql_user', 'mysql_password');
$select_db = mysql_select_db('database_name', $link);

$query = "SELECT * FROM table_name WHERE username='" . $_POST['username'] . "' AND password='" . $_POST['password'] "' LIMIT 1";
$result = mysql_query($query, $link);
$numrows = mysql_num_rows($result);

if($numrows > 0) {
$row = mysql_fetch_assoc($result);
<form name="myform" action="somescript.php" method="post">
<input type="text" name="name" value="<?php echo $row['name']; ?>" />Name<br />
<input type="text" name="name" value="<?php echo $row['address']; ?>" />Address<br />
<input type="text" name="name" value="<?php echo $row['age']; ?>" />Age<br />
<input type="submit" name="submit" value="Submit" />

} else {

echo 'User profile not found.';


Obviously you'll need to heavily modify it to fit in with your form fields and database, etc but that's essentially the basics, you just fill out the value="" part of the form with the data you want to pre-populate. If you get stuck then post what went wrong.

06-06-2005, 06:11 PM
thanx it's working :thumbsup: :thumbsup: