Go Back   CodingForums.com > :: Server side development > PHP

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 12-30-2012, 05:01 AM   PM User | #1
jhdavey
New to the CF scene

 
Join Date: Dec 2012
Posts: 1
Thanks: 1
Thanked 0 Times in 0 Posts
jhdavey is an unknown quantity at this point
Help registering session variables then echo

FIXED THE SESSION VARIABLES. NOW,

I am trying to figure out how to echo an html p element with the $_SESSION variable within the paragraph element

here's my code so far:
Code:
<?php
		if (!isset ($_SESSION['username']))
		{
			echo "<a id='reglink' href='register.html' alt='Register'>Register</a>
			<a id='loginlink' href='login.html' alt='Login'>Login</a>";
		}
		else
		{
			echo 'Welcome' . 'back' . ' ' . $_SESSION['username'] . '!';
		}
		?>
this is will echo the sentence with the correct username, however, i do not have my css style attached to it..
any help is much appreciated!

Last edited by jhdavey; 12-30-2012 at 06:45 AM..
jhdavey is offline   Reply With Quote
Old 12-30-2012, 11:22 AM   PM User | #2
LearningCoder
Regular Coder

 
LearningCoder's Avatar
 
Join Date: Jan 2011
Location: The Pleiades
Posts: 860
Thanks: 68
Thanked 28 Times in 28 Posts
LearningCoder is an unknown quantity at this point
This will work, checked in Firebug showing the text within a <p>.

Code:
echo '<p>Welcome back ' . $_SESSION['username'] . '!</p>';
Or, you can define the <p> to have a class, then just style it in your CSS file:
Code:
echo "<p class='message'>Welcome back ".$user."!</p>";

//then in your CSS file do this:

.message
{
//your styles
}
Regards,

LC.
__________________
Carewizard - http://www.carewizard.co.uk

Last edited by LearningCoder; 12-30-2012 at 11:24 AM..
LearningCoder is offline   Reply With Quote
Users who have thanked LearningCoder for this post:
jhdavey (12-30-2012)
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 12:22 AM.


Advertisement
Log in to turn off these ads.