To be honest, I'd be tempted to just end the PHP tag and use standard HTML. It's much cleaner, and if you're using an IDE, you're going to be able to see your variables much easier.

To be honest, I'd be tempted to just end the PHP tag and use standard HTML. It's much cleaner, and if you're using an IDE, you're going to be able to see your variables much easier.
That is what I use to edit my profile :sPHP Code:// We haven't pressed edit profile, so lets edit it!
// Get some information out of the database
$getuser = mysql_query("SELECT * FROM members WHERE id = '$_SESSION[user_id]' ") or die(mysql_error());
// Get the information into an array
$profile = mysql_fetch_array($getuser);
// Spit all the information we grabbed from the database out
// and enter it into the fields.
echo("<form method=\"post\">
<p>E-mail: <input type=\"text\" name=\"email\" value=\"$profile[email]\" /><br />
Location: <input type=\"text\" name=\"location\" value=\"$profile[location]\" /><br />
MSN address: <input type=\"text\" name=\"MSN\" value=\"$profile[MSN]\" /><br />
Password:<font color=\"#FF0000\">*</font>
<input type=\"password\" name=\"password\" value=\"\" /><br />
Confirm Password: <input type=\"password\" name=\"cpassword\" value=\"\" /><br />
<input type=\"submit\" name=\"update\" value=\"Update password\"><br />
<font color=\"#FF0000\" size=\"2\">* Leave empty if you do not wish to change</font> </p>
</form>");
Blinger when I use your idea I get:
Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING in /home/x/public_html/test/editprofile.php on line 43
I only did the value on the first input.PHP Code:echo "<form action=\"?do=update\" method=\"post\">
first name: <input type=\"text\" name=\"firstname\" value=\"$value['firstname']\" /><br />
last name: <input type=\"text\" name=\"lastname\" /><br />
nick name: <input type=\"text\" name=\"nickname\" /><br />
location: <input type=\"text\" name=\"location\" /><br />
email: <input type=\"text\" name=\"email\" /><br />
gender: <input type=\"checkbox\" name=\"male\" /> male <input type=\"checkbox\" name=\"female\" /> female<br />
bio: <input type=\"text\" height=\"200px\" width=\"300px\" name=\"bio\" /><br />
fav movies: <input type=\"text\" height=\"200px\" width=\"300px\" name=\"favmovies\" /><br />
fav music: <input type=\"text\" height=\"200px\" width=\"300px\" name=\"favmusic\" /><br />
fav books: <input type=\"text\" height=\"200px\" width=\"300px\" name=\"favbooks\" /><br />
<input type=\"submit\" value=\"update profile\" />
</form><br />
<br />
want to change your password?
<form action=\"?do=updatepw\" method=\"post\">
current password: <input type=\"password\" name=\"currentpassword\" /><br />
new password: <input type=\"password\" name=\"newpassword\" /><br />
<input type=\"submit\" value=\"update password\" />
</form>";
Is that what it is in your database?
PHP Code:echo "<form action=\"?do=update\" method=\"post\">
first name: <input type=\"text\" name=\"firstname\" value=\"{$value['firstname']}\" /><br />
last name: <input type=\"text\" name=\"lastname\" /><br />
nick name: <input type=\"text\" name=\"nickname\" /><br />
location: <input type=\"text\" name=\"location\" /><br />
email: <input type=\"text\" name=\"email\" /><br />
gender: <input type=\"checkbox\" name=\"male\" /> male <input type=\"checkbox\" name=\"female\" /> female<br />
bio: <input type=\"text\" height=\"200px\" width=\"300px\" name=\"bio\" /><br />
fav movies: <input type=\"text\" height=\"200px\" width=\"300px\" name=\"favmovies\" /><br />
fav music: <input type=\"text\" height=\"200px\" width=\"300px\" name=\"favmusic\" /><br />
fav books: <input type=\"text\" height=\"200px\" width=\"300px\" name=\"favbooks\" /><br />
<input type=\"submit\" value=\"update profile\" />
</form><br />
<br />
want to change your password?
<form action=\"?do=updatepw\" method=\"post\">
current password: <input type=\"password\" name=\"currentpassword\" /><br />
new password: <input type=\"password\" name=\"newpassword\" /><br />
<input type=\"submit\" value=\"update password\" />
</form>";
Last edited by Trinity; 17-11-2008 at 12:27 AM.
Beau I've tried what you said to do:
however I get an error: Parse error: syntax error, unexpected ';' in /home/kolzy/public_html/test/editprofile.php on line 42 42 is the echo line. "echo ( ?>". There is no ';'.PHP Code:echo ( ?>
<form action="?do=update" method="post">
first name: <input type="text" name="firstname" value="echo /><br />
last name: <input type="text" name="lastname" /><br />
nick name: <input type="text" name="nickname" /><br />
location: <input type="text" name="location" /><br />
email: <input type="text" name="email" /><br />
gender: <input type="checkbox" name="male" /> male <input type="checkbox" name="female" /> female<br />
bio: <input type="text" height="200px" width="300px" name="bio" /><br />
fav movies: <input type="text" height="200px" width="300px" name="movies" /><br />
fav music: <input type="text" height="200px" width="300px" name="movies" /><br />
fav books: <input type="text" height="200px" width="300px" name="movies" /><br />
<input type="submit" value="update profile" />
</form><br />
<br />
want to change your password?
<form action="?do=updatepw" method="post">
current password: <input type="password" name="currentpassword" /><br />
new password: <input type="password" name="newpassword" /><br />
<input type="submit" value="update password" />
</form>
<?php
);
}
?>
EDIT: Thanks Trinity.
Why echo all that out? Just end your PHP tag
?>
and then do that.. and then restart it...
<?php
PHP Code:?>
<form action="?do=update" method="post">
first name: <input type="text" name="firstname" value="<?php echo $value['firstname']; ?>" />
<br/>
last name: <input type="text" name="lastname" />
<br/>
nick name: <input type="text" name="nickname" />
<br/>
location: <input type="text" name="location" />
<br/>
email: <input type="text" name="email" />
<br/>
gender: <input type="checkbox" name="male" />male <input type="checkbox" name="female" />female
<br/>
bio: <input type="text" height="200px" width="300px" name="bio" />
<br/>
fav movies: <input type="text" height="200px" width="300px" name="favmovies" />
<br/>
fav music: <input type="text" height="200px" width="300px" name="favmusic" />
<br/>
fav books: <input type="text" height="200px" width="300px" name="favbooks" />
<br/>
<input type="submit" value="update profile" />
</form>
<br/>
<br/>
want to change your password?
<form action="?do=updatepw" method="post">
current password: <input type="password" name="currentpassword" />
<br/>
new password: <input type="password" name="newpassword" />
<br/>
<input type="submit" value="update password" />
</form>
<?php
Nothing wrong with putting a form in an echo. I personally like to put my form in a variable and every time there's an error it says.
echo "Error: Wrong username or password. <br /> $form";
Thats the way I do it. But you can do it anyway you want really.
Waz ;]
Want to hide these adverts? Register an account for free!