PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
One more thing I wanted to point out. Whenever you already have an HTML document defined, (<html></html> tags are present), the \n will not print a line break. You would need to use <br> instead because a line break in an HTML document is <br>.
BUT, if you are only printing text and you need a line break, both \n and <br> will work. So remember, <br> when HTML page, \n when plain text.
If I'm not mistaken when using echo and print: If you use double quotes it will not extrapolate variables to values. So you can't put $_POST or any other variable inside double quotes if you really want the value of the variable.
Also when trying to get the value from an array (which is what $_POST is) then you must incorporate it in braces {}.
you can turn register_globals on if you don't want to do $_REQUEST. However, there is a slight security issue there because then information submitted via any request is used in your script, not just the info from the particular request you want.
famouskey wrote:Got it! Hate 4.2 for changing defining variables..
The below would show a space instead of line break:
echo $_POST['Choice'], "\n";
To achieve line break need html <br>:
echo $_POST['Choice'], "<br>";
Also found comma and full stop have same use here.
Okay, two things. First, \n and the BReak tag are two completely different things. PHP 4.2 has nothing to do with this. \n Doesn't put a space, it puts a line break in.
Also, using a comma in echo instead of the concatenation symbol (.) is slight faster, because PHP doesn't have to do that concatenation.
protokol wrote:One more thing I wanted to point out. Whenever you already have an HTML document defined, (<html></html> tags are present), the \n will not print a line break. You would need to use <br> instead because a line break in an HTML document is <br>.
BUT, if you are only printing text and you need a line break, both \n and <br> will work. So remember, <br> when HTML page, \n when plain text.
well to make the outputted html look pretty when somebody looks at your "source" this works for me...