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
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'];
            
            ?>
Edited by KaiSheng
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

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