Jump to content

[SOLVED] $_GET messing with lay-out


jkjelle

Recommended Posts

Hi,

 

When I use a $_GET function my lay-out is gone. It seems like it doens't use default.css anymore. Can anybody help me with this problem?

 

This is the URL:

http://www.amejjaou.com/informatica/dvdonline/zoektest.php/?name=The%20Shawshank%20Redemption

 

<?php

include('config.php');

?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">

<head>

<meta http-equiv="content-type" content="text/html; charset=utf-8" />

<title>DVD-ONLINE</title>

<meta name="keywords" content="" />

<meta name="description" content="" />

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

</head>

 

<div id="menu">

<ul>

      <li class="first"><a href="index.php" title="">Home</a></li>

<li class="first"><a href="overzicht.php" title="">Overzicht</a></li>

<li class="first"><a href="zoeken.php" title="">Zoeken</a></li>

<li class="first"><a href="gastenboek.php" title="">Gastenboek</a></li>

                    <li class="first"><a href="gegevens.php" title="">Mijn gegevens</a></li>

<li class="first"><a href="afmelden.php" title="">Afmelden</a></li>

</ul>

</div>

 

<?php

mysql_connect("localhost", "danad", "noureddine") or die(mysql_error());

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

$x=$_GET["name"];

$data = mysql_query("SELECT * FROM info where titel='$x' ")

or die(mysql_error());

Print "<table border=0 cellpadding=5>";

while($info = mysql_fetch_array( $data ))

{

Print "<tr>";

Print " <td><h2>".$info['titel'] . "</h2></td> ";

Print "<tr>";

Print " <td>".$info['afbeelding'] . "</td> ";

Print "<tr>";

Print "<tr>";

Print " <td><h4>genre: </h4>" .$info['genre'] . "</td>";

Print "<tr>";

Print "<tr>";

Print " <td><h4>Jaartal: </h4>" .$info['jaar'] . "</td>";

Print "<tr>";

Print "<tr>";

Print " <td><h4>Trailer:</h4>".$info['trailer'] . "</td> ";

Print "<tr>";

Print "<tr>";

Print "<td><h4> Tijdsduur: </h4>".$info['tijd'] . "</td> ";

Print "<tr>"; 

Print "<tr>";

Print "<td><h4>Samenvatting</h4>".$info['informatie'] . "</td> ";

setcookie("titel", $info['titel'], time() + 60*60);

Print "</table>";

}

?>

</body>

</html>

 

 

Link to comment
https://forums.phpfreaks.com/topic/182010-solved-_get-messing-with-lay-out/
Share on other sites

Never put your real db credentials in a post. :facepalm:

 

Beyond that, a couple of things:

 

1. You're not forming your URL correctly.  It should look like: http://www.amejjaou.com/informatica/dvdonline/zoektest.php?name=The%20Shawshank%20Redemption - note that there ISN'T a '/' after '.php'.

 

2. You can't assume that your script will be getting data passed into it via GET, nor can you assume that data will be safe or legit.  You need to filter it.

 

if(isset($_GET['name']))
{
   //test to see if the data is valid.  If so, access the db
}
else
{
   //no value sent
}

 

3. You don't have an opening <body> tag.

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.