Last name user on form

MichalD

New member
Hi,
I have a problem that I need to take the last_name_user field from the users table and automatically insert it into the field in the order form. i would like this field to fill automatically with the data of the currently logged in user and not show other data from this table. I tried to make a linked table, insert var but it always throws errors. Does anyone have a solution for this?

I am not an expert or a programmer. I'm creating a form for myself and I have no idea about programming.
BTW. DadaBiK is great :)
 
Last edited:

prettem

Member
Hi, you can take the dadabik_users table to search for the value of $current_user, below is an example

global $current_user;
$sql = "SELECT `last_name_user` FROM `dadabik_users` WHERE `username_user` = $current_user";
$res_prepare = prepare_db($conn, $sql);
execute_prepared_db($res_prepare,0);
$row = fetch_row_db($res_prepare);
$last_name=$row[last_name_user];
echo $last_name;

ps dont forget to paste your system info in the footer of your messages in this forum to get help
 
Top