Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8918513
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T05:46:14+00:00 2026-06-15T05:46:14+00:00

i want to show user specific data in html form(in text fields or in

  • 0

i want to show user specific data in html form(in text fields or in select list)

I have a function ShowUserInformation() in class MyClass:

function ShowUserInformation()
{
    $query = "SELECT id, name, email FROM saloni WHERE id = '$_SESSION[ID_korisnika]'";
    $result = mysql_query($query);
    while($row=mysql_fetch_array($result)):
        $id= $row['id'];
        $name= $row['name'];
        $email = $row['email'];
        $address= $row['address'];
        $address2= $row['address2'];
        $address3= $row['address3'];
    endwhile;   

    return $result;
}   

My question is: How can i display value of $name, or $email, $id… on another page in text box or in select list?

If i do it in procedural way it works when i do this:

<input type="text" value="<?php echo $name ?>" name="name" class="" />

But, how can i display the $name,$email,$ID… in oop way? Is there a way to call it directly and not declare it as class variable and then call it.
i’ve included file, created object…

$my_class = new MyClass; //create an object of class

HTML – i’ve tried something like this…

<input type="text" value="<?php echo $my_class->ShowUserInformation($name)?>" name="name" class="" />

I’m new in PHP and oop so be easy with me 🙂

Thank you

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T05:46:15+00:00Added an answer on June 15, 2026 at 5:46 am

    If you only plan on one row being returned, then why not use mysql_fetch_assoc()

    class MyClass{
        public function GetUserInformation(){
            $query = "SELECT id, name, email FROM saloni WHERE id = '$_SESSION[ID_korisnika]'";
            $result = mysql_query($query);
            $info = mysql_fetch_assoc($result);
            return $info;
        } 
    }
    
    $class = new MyClass;
    $info = $class->GetUserInformation();?>
    
    <input type="text" value="<?php echo $info['id']?>" name="id" class="" />
    <input type="text" value="<?php echo $info['name']?>" name="name" class="" />
    

    Note: mysql_* functions are deprecated, and you should move to use MySQLi or PDO

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to show a dialog that will allow the user to select a
i want to show the folder contents in my windows form from where user
I am doing a big project and I want to show user the information
After the first launch of my app i want to show the user a
Similar to the Simon games of old, I want to show the user a
I use ASP.NET I want to show percentage to user from codebehind while database
I want to show a open dialog for the user, where the user can
I want to show messagebox to the user, such that the user cannot refuse
I want to show a modal dialog/pop-up window when the user has not filled
i want to show all the vehicle maintenance history when user click on the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.