I have a fundamental problem that takes a bit of explaining -
This is the code in my navbar which is stored in a file called squarenav.php
<a href="index.php?myvarstf=myvarstf&title=MHAP+-+Forward+This+Page&pagevar= variable will go here ">
<div class="square square3"><div class="icontext">Forward This Page</div>
</div>
</a>
It is included in my root document that loads in web page content depending on which navbar button is clicked
include("plug-in/squarenav.php");
if (isset($_GET["myvar"])) { $name1 = $_GET["myvar"]; }
if (isset($_GET["myvarstf"])) { $namestf = $_GET["myvarstf"]; }
if (isset($_GET["myvar2"])) { $name2 = $_GET["myvar2"]; }
if (isset($name1)) {
include("plug-in/home.php");
}
elseif(isset($namestf)){
include("plug-in/sendtofriend.php");
}
elseif(isset($name2)){
include("plug-in/aboutadvoc.php");
} else{
include("plug-in/home.php");
}
one of the "web content" pages called (send web page to a friend) allows the user to
send the url of the page they are currently on to a friend -
sendtofriend.php
<?php if (isset($_GET['title'])) { ?>
<h1>Just Fill In a Few Details</h1>
<div class="center_form">
<form name="form1" method="post" action="">
<p>
<label for="friend">Your friend's name:</label>
<input type="text" name="friend" id="friend">
</p>
<p>
<label for="to">Your friend's email address:</label>
<input type="text" name="to" id="to">
</p>
<p>
<label for="you">Your name:</label>
<input type="text" name="you" id="you">
</p>
<p>
<label for="sender">Your email address:</label>
<input type="text" name="sender" id="sender">
</p>
<p>
<label for="comments">Comments:</label>
<textarea name="comments" id="comments"></textarea>
</p>
<p>
<input type="submit" name="send" id="send" value="Send to Friend">
<input name="title" type="hidden" id="title" value="<?php echo $_GET['title']; ?>">
<input name="url" type="hidden" id="url" value="<?php if (isset($_SERVER['HTTP_REFERER'])) {
echo $_SERVER['HTTP_REFERER'];
}?>">
</p>
</form>
</div>
<?php } else { ?>
<h1>Oops!</h1>
<p>You seem to have landed on this page by error.</p>
this is a typical page that the user could send a link to
aboutadvoc.php
<h1 class="cent">About Advoc</h1>
$results = $connection->query("SELECT message FROM aboutadvoc");
while($row = $results->fetch_assoc())
{
echo '<p>' . $row["message"] . '</p>';
}
//close db connection
$connection->close();
So the user is on aboutadvoc.php the navbar is above with a button called Send to Friend,
which ideally when clicked loads the send to friend page with details of the aboutadvoc.php page
So say I am on another page ... home.php and I have the same navbar above and I click the
Send to Friend button. How does sendtofriend.php know which page I am coming from?
My first thought was to add a variable to the navbar $page_details
<a href="index.php?myvarstf=myvarstf&title=MHAP+-+Forward+This+Page&pagevar=$page_details">
And say on aboutadvoc.php have
$page_details = " About Advoc";
An on home.php have
$page_details = " Home Page";
However when I try this, the browser address bar shows pagevar= as empty
http://localhost/advoc/index.php?myvarstf=myvarstf&title=MHAP+-+Forward+This+Page&pagevar=
So after all that... few...
How do I add $page_details to the navbar button and change its content depending on which page I am currently on?
<a href="index.php?myvarstf=myvarstf&title=MHAP+-+Forward+This+Page&pagevar=$page_details">