learningphpisfun Posted July 4, 2013 Share Posted July 4, 2013 hi...how do i linebreak three echo variables so they are not in the same line?.. so it looks like this (instead of all on the same line): Name: $membernameAge: $memberageGender: $membergender I tried to do the following that was recommended to linebreak the variables into different lines..but it ended up being on the same line.echo: "Name: $membername\n Age:$memberage\n Gender: $membergender";Here is the code below...Thanks in advance:===============<?php $info = mysql_query("SELECT * FROM `info` WHERE `id`='".$_SESSION['uid']."'") or die(mysql_error()); $info1 = mysql_fetch_assoc($info; $membername = $info1['membername']; $memberage = $info1['memberage']; $membergender = $info1['membergender']; echo "Name: $membername"; echo "Age: $memberage"; echo "Gender: $membergender"; ?> Link to comment https://forums.phpfreaks.com/topic/279872-linebreaking-three-echo-variables/ Share on other sites More sharing options...
insidus Posted July 4, 2013 Share Posted July 4, 2013 I think instead of \n its \r\n. You could always print them inside <pre> tags, or use var_dump(), which will print the information + a little more on separate lines. edit. or simply use <br /> tags Link to comment https://forums.phpfreaks.com/topic/279872-linebreaking-three-echo-variables/#findComment-1439452 Share on other sites More sharing options...
Barand Posted July 4, 2013 Share Posted July 4, 2013 It seems like you need to to learn the basics of HTML before you embark on PHP to produce web pages Link to comment https://forums.phpfreaks.com/topic/279872-linebreaking-three-echo-variables/#findComment-1439464 Share on other sites More sharing options...
learningphpisfun Posted July 5, 2013 Author Share Posted July 5, 2013 @insidius...thanks for the response... I tried to embed html within php and it didn't work cause I placed the </br> outside the echo quotes..... Your response made me think there was a way to embed html within php...and I did some googling and found out that I have to put the </br> inside the quote and not outside... I know it seems noobish but the php tutorial that I was following just showed how to make a basic registration form that echos "welcome $User" when you successfully log in.. It didn't cover embedding html within php or anything... The only time the tutorial used html was to create the form and that was outside <?php ?>..so i didn't have any examples of embedding html within php to use as a guide...anyways a million thanks for responding with a productive and useful solution. Link to comment https://forums.phpfreaks.com/topic/279872-linebreaking-three-echo-variables/#findComment-1439497 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.