Jump to content

Using get in a file include?


wright67uk

Recommended Posts

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