Jump to content

[SOLVED] Whats wrong here?? :(


zartzar

Recommended Posts

I have to create a page for which you can select 3 different layouts. I used includes to do this, eg 1head.php 2head.php etc. I used $_GET to retrieve the variables. Not to suprise it doesnt work. Please help me! error is on line 23 (include('includes/{$num}head.php');)

 

My code:

 

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

<html>

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

<title> | Prac 7</title>

</head>

<body>

<center>

<div class="header">Prac 7</div>

<?php


$num=1

include('includes/{$num}head.php');
include('includes/{$num}left.php');




print '<td>


Select a layout:</br>


$num=$GET['num'];


<a href="index.php">Layout1</a></br>

<a href="index.php?num=2">Layout2</a></br>

<a href="index.php?num=3">Layout3</a>




</td>';




include('includes/{$num}right.php');
include('includes/{$num}foot.php');








?>

</div>

</center>

</body>

</html>

 

EDITED BY WILDTEEN88: Please use code tags (


) when posting code

Link to comment
https://forums.phpfreaks.com/topic/152656-solved-whats-wrong-here/
Share on other sites

 

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<head>
<link rel="stylesheet" href="styles.css" type="text/css"/>
<title> | Prac 7</title>
</head>
<body>

<div class="header">Prac 7</div>

<?php
$num = (isset($_GET['num']) && is_numeric($_GET['num'])) ? $_GET['num'] : 1;
include("includes/{$num}head.php");
include("includes/{$num}left.php");
?>


<p>
  Select a layout:</br>
  <a href="index.php">Layout1</a></br>
  <a href="index.php?num=2">Layout2</a></br>
  <a href="index.php?num=3">Layout3</a>
</p>

<?php
include('includes/{$num}right.php');
include('includes/{$num}foot.php');
?>

</body>
</html>

 

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<head>
<link rel="stylesheet" href="styles.css" type="text/css"/>
<title> | Prac 7</title>
</head>
<body>

<div class="header">Prac 7</div>

<?php
$num = (isset($_GET['num']) && is_numeric($_GET['num'])) ? $_GET['num'] : 1;
include("includes/{$num}head.php");
include("includes/{$num}left.php");
?>


<p>
  Select a layout:</br>
  <a href="index.php">Layout1</a></br>
  <a href="index.php?num=2">Layout2</a></br>
  <a href="index.php?num=3">Layout3</a>
</p>

<?php
include('includes/{$num}right.php');
include('includes/{$num}foot.php');
?>

</body>
</html>

 

Thx mate! :)

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.