zartzar Posted April 5, 2009 Share Posted April 5, 2009 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 More sharing options...
zartzar Posted April 5, 2009 Author Share Posted April 5, 2009 EDIT: accidental qoute oops Link to comment https://forums.phpfreaks.com/topic/152656-solved-whats-wrong-here/#findComment-801690 Share on other sites More sharing options...
wildteen88 Posted April 5, 2009 Share Posted April 5, 2009 <!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> Link to comment https://forums.phpfreaks.com/topic/152656-solved-whats-wrong-here/#findComment-801692 Share on other sites More sharing options...
zartzar Posted April 5, 2009 Author Share Posted April 5, 2009 <!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! Link to comment https://forums.phpfreaks.com/topic/152656-solved-whats-wrong-here/#findComment-801710 Share on other sites More sharing options...
wildteen88 Posted April 5, 2009 Share Posted April 5, 2009 Oops. Forgot something include('includes/{$num}right.php'); include('includes/{$num}foot.php'); Should of been include("includes/{$num}right.php"); include("includes/{$num}foot.php"); Link to comment https://forums.phpfreaks.com/topic/152656-solved-whats-wrong-here/#findComment-801712 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.