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,), Link to comment https://forums.phpfreaks.com/topic/283347-auto-fill-the-username-in-an-form-how/ 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(), Link to comment https://forums.phpfreaks.com/topic/283347-auto-fill-the-username-in-an-form-how/#findComment-1455831 Share on other sites More sharing options...
KaiSheng Posted November 12, 2013 Share Posted November 12, 2013 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']; ?> Link to comment https://forums.phpfreaks.com/topic/283347-auto-fill-the-username-in-an-form-how/#findComment-1457975 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.