Clinton Posted September 9, 2007 Share Posted September 9, 2007 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 https://forums.phpfreaks.com/topic/68620-solved-prefilling-a-form-with-php-data/ Share on other sites More sharing options...
pocobueno1388 Posted September 9, 2007 Share Posted September 9, 2007 Change the line to this: <input type="text" name="First" maxlength="60" value="<? echo $row['First']; ?>"> Link to comment https://forums.phpfreaks.com/topic/68620-solved-prefilling-a-form-with-php-data/#findComment-344891 Share on other sites More sharing options...
Clinton Posted September 9, 2007 Author Share Posted September 9, 2007 Thank you. Link to comment https://forums.phpfreaks.com/topic/68620-solved-prefilling-a-form-with-php-data/#findComment-344896 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.