tommy1 Posted October 27, 2013 Share Posted October 27, 2013 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! 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,), Quote Link to comment Share on other sites More sharing options...
Ch0cu3r Posted October 28, 2013 Share Posted October 28, 2013 Have you tried changing 'value' => $sDefaultTitle, to 'value' => getUsername(), Quote Link to comment Share on other sites More sharing options...
KaiSheng Posted November 12, 2013 Share Posted November 12, 2013 (edited) 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 November 12, 2013 by KaiSheng Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.