Page 1 of 1
PHP code tags adding extra line on display
Posted: Sun Jul 25, 2010 4:56 am
by Gloomy
Hey im messing around with some php and noticed that when ever I use something like
Code: Select all
<?php
echo "hello";
?>
<font face="Arial" size="2">goodbye</font>
really simple, it adds a line between hello and goodbye when I run it in a browser, like
Is there a way I could get the print out to remove the extra line so it appears like
?
only used this as an example, the actual php im trying to work with only prints out if a IF condition is true but that works fine, no idea how to remove that extra space tho, any suggestions would be great thanks

Re: PHP code tags adding extra line on display
Posted: Sun Jul 25, 2010 7:41 am
by yacahuma
Is this in a command line or in html output?
Re: PHP code tags adding extra line on display
Posted: Sun Jul 25, 2010 7:57 am
by Gloomy
Its a website, being viewed in a web browser, chrome to be specific, I wasent aware that you could use the code I gave above in my first post in terminal, maybe pieces of it, but as a whole... nope dont think so.
Would really love any help here, it seems like such a simple problem and cant seem to find any solutions, surely i not the first person to encounter this lol
Re: PHP code tags adding extra line on display
Posted: Sun Jul 25, 2010 8:15 am
by yacahuma
The code you posted cannot include a br which is the only possible way you get a new line. The other way will be if you have a css like this
<style>
font {display:block}
</style>
Re: PHP code tags adding extra line on display
Posted: Sun Jul 25, 2010 8:24 am
by Gloomy
hmm thanks, i just tried it out without all my other code, it prints out exactly as it should, didnt think to check it.
Theres something with my other code that is messing with it lol, damnit, was hoping for something simple

Re: PHP code tags adding extra line on display
Posted: Sun Jul 25, 2010 8:47 am
by Gloomy
woot! found the problem!, havent solved it, im up happy i found it lol, its the <form> tag. can someone please explain why there is a <br> between the form and the php code
Code: Select all
<?php
echo "inside php";
?>
<form>
inside form
</form>
I thought it should print out like
or maybe
except it prints out like...
but it only does it for the <form> tag, any ideas?
Re: PHP code tags adding extra line on display
Posted: Sun Jul 25, 2010 9:03 am
by Gloomy
incase anyone else has this annoying little problem, simple as it is it took me agggggessssssss to find a solution, here it is.
Code: Select all
<STYLE type="text/css">
form{display:inline;}
</STYLE>
<?php
hello
?>
<form action="--WEBBOT-SELF--" method="POST">inside form
</form>
