I have some code which echo's a paragraph from a database, but is there anyway to make the paragraph have a title by calling the same Field? I've had a look for formating text which is being echoed, but I'm not sure how to go about having a title one <br> above the rest of the text. Anyone got any idea how to achieve this? eg:

This is what's being echoed at the moment:

texttexttexttexttexttexttexttexttexttexttexttexttexttexttexttexttexttexttext
texttexttexttexttexttexttexttexttexttexttexttexttexttexttexttexttexttexttext
texttexttexttexttexttexttexttexttexttexttexttexttexttexttexttexttexttexttext
texttexttexttexttexttexttexttexttexttexttexttexttexttexttexttexttexttexttext


The effect I'm trying to achieve:

title

texttexttexttexttexttexttexttexttexttexttexttexttexttexttexttexttexttexttext
texttexttexttexttexttexttexttexttexttexttexttexttexttexttexttexttexttexttext
texttexttexttexttexttexttexttexttexttexttexttexttexttexttexttexttexttexttext
texttexttexttexttexttexttexttexttexttexttexttexttexttexttexttexttexttexttext

The question that you are asking is for a pretty basic html capability. I suggest that you spend some time on the W3schools site or on some other html tutorial and use W3schools as an ongoing reference. If you are going to be doing more work in html / php then you'll have a lot more questions and it doesn't make sense to be posting them one at a time as you try to do something new. Once you've done the tutorials and done some research on a specific question, then come back if you can't find an answer.

For this particular question, have a look at the link below:
http://www.w3schools.com/TAGS/tag_hn.asp

The question that you are asking is for a pretty basic html capability. I suggest that you spend some time on the W3schools site or on some other html tutorial and use W3schools as an ongoing reference. If you are going to be doing more work in html / php then you'll have a lot more questions and it doesn't make sense to be posting them one at a time as you try to do something new. Once you've done the tutorials and done some research on a specific question, then come back if you can't find an answer.

For this particular question, have a look at the link below:
http://www.w3schools.com/TAGS/tag_hn.asp

No no, you've miss understood my question. The text is in a database, and I'm using PHP to display it. my question was how to format text IN the database.

I wasn't sure whether you could simply edit the text in the database with html and have it read correctly when it was echoed. But I've just tried it and turns out you can.

My mistake, I didn't realize it'd understand HTML in the same way. Apologies.

simply use something like this in your database field

<p>title</p><p>texttexttext<br />texttexttext</p>

and that will work fine.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.