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.
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.
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.
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
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!