Inserting PHP as a form value

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
4Boredom
Forum Contributor
Posts: 176
Joined: Tue Nov 08, 2005 4:29 pm

Inserting PHP as a form value

Post by 4Boredom »

I am trying to insert a php variable into a form text field, anyone know how?

Code: Select all

<tr>  
      <td align=center valign=top>Display Name: </td> 
      <td><input name=username type=text id=username value=<? $username ?>></td> 
    </tr>
This code didnt do anything
User avatar
Burrito
Spockulator
Posts: 4715
Joined: Wed Feb 04, 2004 8:15 pm
Location: Eden, Utah

Post by Burrito »

you need to echo it:

Code: Select all

<tr>  
      <td align=center valign=top>Display Name: </td> 
      <td><input name=username type=text id=username value=<?php echo $username ?>></td> 
    </tr>
4Boredom
Forum Contributor
Posts: 176
Joined: Tue Nov 08, 2005 4:29 pm

Post by 4Boredom »

thanks it works perfect.... thanks for the quick reply :)
Post Reply