Doe anyone here know the ascii code for the enter(newline)??
im not looking for the '\n' answer..
thanks..:)

Recommended Answers

All 6 Replies

i think 13
i dont know in which aspect you are asking

but its 13

i think its 10 for newline
and you can get it using ord() function in php

hope this helps you

<?php
    $name_clean =$name;
    $name_clean = str_replace("↵","[ENTER]",$name_clean);
    $name_clean = str_replace("[ENTER]","&#13 ",$name_clean);
    $sql="iNSERT into INFO($name) values('$name_clean'";
    mysql_query($sql);
?>

I tried it but it's not working.. This is my problem..

 $name = "This is the Example.
    This is the example2";

The output I want to happen is..

    This is the example.
    This is the example2.

But when i displayed it on the webpage, the 1st sentence is concatenated with the 2nd sentence. So I need to use this. . .

$name = "This is the Example.<BR>
This is the example2";

Can you suggest an alternative solution for this.. thanks..

Instead of "str_replace("↵","[ENTER]",$name_clean);" use nl2br($name_clean).

can you please explain your actual requirement?

so that we try to give a solution to your problem.

Member Avatar for diafol

nl2br(), as mentioned, is what you need.

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.