wright67uk Posted April 11, 2011 Share Posted April 11, 2011 Hello, Im trying to pass a variable to a newly created page using GET. $query = mysql_query("SELECT DISTINCT subtype FROM business WHERE type ='Restaurant' ORDER BY name"); echo mysql_error(); while($ntx=mysql_fetch_row($query)) $nt[] = $ntx[0]; $i = -1; foreach($nt as $value) {$i++; echo "<a href='" . str_replace(' ','_',$nt[$i]) . ".php?title=$title'>" . $nt[$i] . "</a>" . "<br/>"; $FileName = str_replace(' ','_',$nt[$i]) . ".php"; $FileHandle = fopen($FileName, 'w') or die("cant open file"); $pageContents = file_get_contents("header.php"); fwrite($FileHandle,"$pageContents");} fclose($FileHandle); header.php <head> <?php $title = $_GET['Title']; ?> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Untitled Document</title> </head> <body> <p>HEADER UPDATED!</p> <p>TESTING - the heading below should read (title goes here in capital letters)</p> <?php <h1>$title</h1> ?> //This is line 12 </body> </html> Im getting the error; Parse error: syntax error, unexpected '<' in D:\Hosting\3753557\html\1pw\mexican.php on line 12 I suspect that I have my syntax muddled in header.php? Is there a better way to pass variables to a newly created page? (fopen). Many thanks for any ideas. Link to comment https://forums.phpfreaks.com/topic/233411-using-get-in-a-file-include/ Share on other sites More sharing options...
spiderwell Posted April 11, 2011 Share Posted April 11, 2011 <?php echo "<h1>$title</h1>" ?> //This is line 12 Link to comment https://forums.phpfreaks.com/topic/233411-using-get-in-a-file-include/#findComment-1200278 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.