Jump to content

Auto fill the username in an form, how?


tommy1

Recommended Posts

I need help with this. I have a form for add new users. But I don't want users to change the Title - I want to auto fill the username they have already. Right now it look like the picture. But I want to echo getUsername(); Any one can help me with this? Please!

 

 

 

zmd3sy.png

 

Here is my form code now. Any one? Please!

 

),
'title' => array(
'type' => 'text',
'name' => 'title',
'caption' => _t('_modzzz_model_form_caption_title'),
'value' => $sDefaultTitle,
'required' => true,
'checker' => array (
'func' => 'length',
'params' => array(3,$this->_oMain->_oConfig->getTitleLength()),
'error' => _t ('_modzzz_model_form_err_title'),
),
'db' => array (
'pass' => 'Xss',
),
'display' => true,
),

Link to comment
https://forums.phpfreaks.com/topic/283347-auto-fill-the-username-in-an-form-how/
Share on other sites

  • 2 weeks later...

simple, 

just do this.

 

Username:<input type="text"  name="username" size="17" value="<?php echo $row['username']; ?>" readonly="readonly"  >
 
 
be sure to do this before that code.
            <?php 
            
 
        //match the username and password entered with database record
        $query = ("SELECT id,role,username FROM `users` WHERE id='".$_SESSION['user_id']."'");
        $result = mysqli_query($link, $query) or die(mysqli_error($link));
            $row = mysqli_fetch_array($result);
            $_SESSION['user_id']= $row['id'];
            $_SESSION['username'] = $row['username'];
            
            ?>

Archived

This topic is now archived and is closed to further replies.

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