...

View Full Version : Resolved Php not staying side of DIV



masterofollies
03-03-2009, 08:41 PM
I am trying to create a profile page which works fine in an all php script. However combining it with html it doesn't work. I attached a screenshot of what it does and the coding.

http://www.rodgame.org/projects/dmv/profile.php


<div id="page">
<div id="content">

<?php

function profile() {
if(!empty($_SESSION["user_id"])){

echo "Welcome ".$row['username']." to your profile.";
}
}

?>

</div>

<div style="clear: both;">&nbsp;</div>
</div>
<!-- end #page -->
<div id="footer">
<p>Copyright (c) 2009 Sitename.com. All rights reserved. Design by Success Web Designs.</p>
</div>

Fumigator
03-03-2009, 08:46 PM
I see that you are defining a function, but I don't see where you're calling that function. The location in the code where you call the function is where the echos are going to dump bytes into the html.

masterofollies
03-03-2009, 08:51 PM
Sorry here is the GET for it.


if (isset($_GET["x"])) {
$x = explode(":",$_GET["x"]);

switch($x[0])
{
case 'profile':
profile($x[1]);
break;

Fumigator
03-03-2009, 09:06 PM
I hope you got my point? You have to call your profile() function at the position where you want the html from the function dumped.

masterofollies
03-03-2009, 11:10 PM
I don't quite follow. Do you mean put the GET method in the content area?

sea4me
03-04-2009, 12:50 AM
yes, that is what he means.

Where ever the function profile() is called, that is where the echo is gonna take place


<div id="page">
<div id="content">

<?php

function profile() {
if(!empty($_SESSION["user_id"])){

echo "Welcome ".$row['username']." to your profile.";
}
}

if (isset($_GET["x"])) {
$x = explode(":",$_GET["x"]);

switch($x[0])
{
case 'profile':
profile($x[1]);
break;
}
?>

</div>

<div style="clear: both;">&nbsp;</div>
</div>
<!-- end #page -->
<div id="footer">
<p>Copyright (c) 2009 Sitename.com. All rights reserved. Design by Success Web Designs.</p>
</div>

masterofollies
03-04-2009, 12:55 AM
Cool it works, thanks

sea4me
03-04-2009, 03:12 AM
Ur welcome!



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum