I want to grab fields from a webpage and put them in the string and print it

i want to make a string in which i want to store a information of the fields dynamically.
For Eg :- i have a page in which fields like name, date, images that have been uploaded by user are available.
What will be the format of writing that line of code in which i can store details in string. And it has to be dynamically.