HI - I need help in creating html file using PHP

Discussion in 'PHP' started by kks_krishna, Apr 14, 2007.

  1. #1
    HI All,

    I am writing PHP code to create HTML files inputed from the user. I have to display the newly created html file in the same format how user entered his data. Please give your ideas to complete this work.
     
    kks_krishna, Apr 14, 2007 IP
  2. abixalmon

    abixalmon Well-Known Member

    Messages:
    378
    Likes Received:
    7
    Best Answers:
    0
    Trophy Points:
    120
    #2
    Can you give us the complete detail of what you want so that we can help u?
     
    abixalmon, Apr 14, 2007 IP
  3. kks_krishna

    kks_krishna Active Member

    Messages:
    1,495
    Likes Received:
    17
    Best Answers:
    0
    Trophy Points:
    80
    #3
    If user has the form and entering the details. he may be enterest many paragrapghs with new line. i will create new html file with data enter by the user. so that the file will be live within moment.
     
    kks_krishna, Apr 14, 2007 IP
  4. Weizheng

    Weizheng Peon

    Messages:
    93
    Likes Received:
    6
    Best Answers:
    0
    Trophy Points:
    0
    #4
    Are the user input purely text data?
    If it is, just dump the all the input between <pre> and </pre> and it should look fine. All new lines are preserved inside these tags.
     
    Weizheng, Apr 15, 2007 IP
  5. kks_krishna

    kks_krishna Active Member

    Messages:
    1,495
    Likes Received:
    17
    Best Answers:
    0
    Trophy Points:
    80
    #5
    thanks for you idea.
     
    kks_krishna, Apr 15, 2007 IP
  6. bluesaga

    bluesaga Peon

    Messages:
    102
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    0
    #6
    can use <textarea> or <code> (<code> is not all browser compliant)

    If you have php, you can just use htmlentities and then print out the data, im not sure exactly what you want though
     
    bluesaga, Apr 16, 2007 IP
  7. abixalmon

    abixalmon Well-Known Member

    Messages:
    378
    Likes Received:
    7
    Best Answers:
    0
    Trophy Points:
    120
    #7
    Easy way to format the data with newline is

    1. Receive the data using $_POST['posted']
    2. Insert line breaks using nl2br($variable)
    3. Echo / Print the output using echo $variable or print($variable)

    Simple!
     
    abixalmon, Apr 25, 2007 IP