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

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.