SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    Non-Member MrLister's Avatar
    Join Date
    Feb 2001
    Posts
    108
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Minor Text Formatting

    I looked over the other posts about formatting text but couldn't find anything useful. I'm not sure which or how to go about this. But here's a quick intro of what the script is suppose to do.

    in the admin area. Think of "________" as a form field.

    Essay Name ______________

    Title of point #1______________
    Point #1_________________
    ___________________
    ___________________

    Title of point #2______________
    Point #2_________________
    ___________________
    ___________________

    What i'm trying to do is when it sends it the database it does it so it looks like this
    <b>[title of point #1]</b>
    point #1
    <b>[title of point #2]</b>

    how would i do this?

  2. #2
    SitePoint Addict
    Join Date
    Jun 2001
    Location
    Newcastle, England
    Posts
    268
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I'm not 100% sure what you mean - do you mean you want to write one load of data to the database? So you take whatever's entered in several form fields and combine them into a formatted whole, then store that off?

    If that's what you mean, you simply need to concatenate the strings together. In the page which handles the event and writes to the database, you could just do something like this (assuming your form elements are called title1, point1 etc.):

    Code:
    $complete_post = "<b>" . $title1 . "</b>" . $point1 ....
    So in effect you're building up one long string with the contents of all the form fields plus whatever formatting you need. You then store this string in the database, rather than all of the seperate strings.

    Is that what you meant? An alternative would be to store in the database just what they actually typed, but when you display that data add the formatting elements. That's what's commonly done in many applications (forums, news scripts, content scripts etc.) as it means you can store their input unchanged.

    Hope that covers what you were asking, if not please post again .


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •