# from database to a form field on the next page?

**URL:** <https://www.phphelp.com/t/from-database-to-a-form-field-on-the-next-page/12206>\
**Category:** Beginners - Learning PHP\
**Created:** [December 1, 2010, 4:50pm UTC](https://www.phphelp.com/t/from-database-to-a-form-field-on-the-next-page/12206 "2010-12-01T16:50:53Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![sandmantfc](https://www.phphelp.com/letter_avatar_proxy/v4/letter/s/a8b319/32.png) [@sandmantfc](https://www.phphelp.com/u/sandmantfc)\
**Post date:** [December 1, 2010, 4:50pm UTC](https://www.phphelp.com/t/from-database-to-a-form-field-on-the-next-page/12206/1 "2010-12-01T16:50:53Z")

</div>

When a messege is read and the user replies how do I get the person who sent it username in the formfield of the next page? Thx

---

<div class="post-metadata">

**Author:** ![OpzMaster](https://www.phphelp.com/letter_avatar_proxy/v4/letter/o/a9adbd/32.png) [@OpzMaster](https://www.phphelp.com/u/OpzMaster)\
**Post date:** [December 2, 2010, 12:56am UTC](https://www.phphelp.com/t/from-database-to-a-form-field-on-the-next-page/12206/2 "2010-12-02T00:56:30Z")

</div>

If I understand what you are asking, you want to take the username of the user and prepopulate a form field on another page. If that’s what you want, you can create a session variable ($\_SESSION[‘username’]) and populate the variable with the name of the person. On the next page you can populate the value of the form field with the SESSION variable. You need to start both pages with the following PHP syntax session\_start().

Start your pages inside the PHP tags with  
[php]session\_start();[/php]

And prepopulate your form field

```auto
<input type="text" name="username" value="<?php echo $_SESSION['username']?>">
```

Hope this helps…
