Php display information in the form

I have a feature that allows members to update their personal data when they are logged in, on the update page there is a form filled in by the user, and when the submit button is clicked, the deatils files are updated. This works fine, I want to show the current user data in the corresponding text that was submitted in the form, for example. the firstname text box will have a value of "James" and the user can delete this to enter "jim". Is this somehow related to adding a value to the form field? My form is shown below.

    <tr>
    <td width="78">Firstname</td>
    <td width="6">:</td>
    <td width="294"><input name="firstname" type="text" id="firstname"></td>
    </tr>
    <tr>
    <td width="78">Surname</td>
    <td width="6">:</td>
    <td width="294"><input name="surname" type="text" id="surname"></td>
    </tr>

Any help is much appreciated

+3
source share
2 answers

Print the value inside the text box.

<input type="text" value="<?php echo $someValue; ?>" />

+1
source

echo '<input type="text" value="'. $someValue .'" />';

OR

<input type="text" value="<?php echo $someValue; ?>" />

, .php $someValue . . .

+1

All Articles