Jump to content

Linebreaking three echo variables


Recommended Posts

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: $membername
Age: $memberage
Gender: $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

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.