Jump to content

[SOLVED] Prefilling a form with PHP Data


Clinton

Recommended Posts

I'm trying to fill out a form with data pulled from a database. Look at the first entry for my form, the First Name. I have a PHP in the value section but it is not pulling down the data and inserting it. Not sure why. Any help would be appreciated.

 

<?

// connect to database
include("inc/connect.php");

// include auth and nav
include("inc/auth.php");
include("inc/nav.php");

?>

<?

$rn=("SELECT * FROM users WHERE
username='" . $_SESSION['username']."'");

$rz=mysql_query($rn);

while($row=mysql_fetch_array($rz))
{
if($row["Status"]=="0"){
echo ("<br>Have a great day! <a href='logout.php'>Close</a>");
}else{
?>

<?php
}
else
{
?>


<form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post">
<p>
<table border="0">
<tr><td>First Name:</td><td>
<input type="text" name="First" maxlength="60" value="<?$row['First'] ?>">
</td></tr>
<tr><td>Middle Initial:</td><td>
<input type="text" name="MI" maxlength="60">
</td></tr>
<tr><td>Last Name:</td><td>
<input type="text" name="Last" maxlength="60">
</td></tr>
<tr><td>E-mail:</td><td>
<input type="text" name="Email" maxlength="100">
</td></tr>
<tr><td>Home Phone:</td><td>
<input type="text" name="Phone" maxlength="60">
</td></tr>
<tr><td>Cell Phone:</td><td>
<input type="text" name="CellPhone" maxlength="60">
</td></tr>
<tr><td>Username:</td><td>
<input type="text" name="username" maxlength="60">
</td></tr>
<tr><td>Password:</td><td>
<input type="password" name="password" maxlength="10">
</td></tr>
<tr><td>Confirm Password:</td><td>
<input type="password" name="password2" maxlength="10">
</td></tr>
<tr><th colspan=2><input type="submit" name="submit" value="Register"></th></tr> </table>
</form>

<?php
}}}
?>

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

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