Jump to content

div inside php script?


tml

Recommended Posts

my problem is, i cant put my div into my script without break it and then rest wont work...

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN">

<html>

<head>

<title>vores hjemmeside</title>

<link rel="stylesheet" type="text/css" href="style.css">

</head>

<body>

<div id="side">

  <div id="hoved"><img src="billed/banner.jpg">

 

  </div>

  <div id="links">

  <center>

<a href="index.php">Forside</a>  

<a href="index.php?side=os">os</a>  

<a href="index.php?side=kira">kira</a>  

<a href="index.php?side=billeder">billeder</a>  

  </center>

  </div>

  <div id="indhold">

 

<?php

 

if ($_GET['side'] == os)

{

echo "os";      //indhold af side 1

}

 

elseif ($_GET['side'] == kira)

{

    //indhold af side 2

 

 

}

elseif ($_GET['side'] == billeder)

{

 

// here are the problem when i try inset this div

 

<div id="billedmenu">

 

<a href="index.php?side=kira">kira</a>

 

</div>

 

<div id="billedindhold" class="clear">

mysql_connect("localhost", "xx", "xx") or die(mysql_error());

mysql_select_db("xx") or die(mysql_error());

 

$query = mysql_query("SELECT * FROM billed ORDER BY id DESC");

while($row = mysql_fetch_assoc($query))

{

echo "<a href='{$row["sti"]}'><img src='{$row["lille"]}' class='foto' border='0' /></a>";

}

</div>

}

else echo "hej"; //forside

?>

</div>

 

 

</body>

</html>

Link to comment
Share on other sites

echo the divs out.

 

or just end your code with ?> before the div and start it again <?php after it

 

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN">
<html>
<head>
<title>vores hjemmeside</title>
<link rel="stylesheet" type="text/css" href="style.css">
</head>
<body>
<div id="side">
   <div id="hoved"><img src="billed/banner.jpg">

   </div>
   <div id="links">
   <center>
<a href="index.php">Forside</a>  
<a href="index.php?side=os">os</a>  
<a href="index.php?side=kira">kira</a>  
<a href="index.php?side=billeder">billeder</a>  
   </center>
  </div>
  <div id="indhold">

<?php

if ($_GET['side'] == os)
{
echo "os";       //indhold af side 1
}

elseif ($_GET['side'] == kira)
{
     //indhold af side 2


}
elseif ($_GET['side'] == billeder)
{
//If you have several lines, it's usually easier to pause/resume PHP
?>

<div id="billedmenu">

<a href="index.php?side=kira">kira</a>

</div>

<div id="billedindhold" class="clear">
<?php
mysql_connect("localhost", "xx", "xx") or die(mysql_error());
mysql_select_db("xx") or die(mysql_error());

$query = mysql_query("SELECT * FROM billed ORDER BY id DESC");
while($row = mysql_fetch_assoc($query))
{
echo "<a href='{$row["sti"]}'><img src='{$row["lille"]}' class='foto' border='0' /></a>";
}
//For one line, just use echo
echo '</div>';
}
else echo "hej"; //forside
?>
</div>


</body>
</html> 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.