Hi all,
I want to create an 'apply' button that when pressed redirects to the contact page but then the title of this page is also carried forward.
Any ideas?
Hi all,
I want to create an 'apply' button that when pressed redirects to the contact page but then the title of this page is also carried forward.
Any ideas?
maybe something like that in your loop
<a href="link_to_the_contact.php?title=<?php the_title(); ?>contact</a>"
Your title will be in the variable $_GET['title']
Fantastic, worked a treat.
Further thoughts, i need this to be sent with the contact form. I could display the full URL to give a clue to where the user has come from. Or do you have a better idea?
p.s. Thank you
I think you can have the uri of the previous page with
$_SERVER["HTTP_REFERER"]
unfortunately not :-(
o_O
try to put this in a page
echo $_SERVER["HTTP_REFERER"];
it should display the uri of the previous page !
(if you come from a previous page, and don't type the uri directly)
;-) Thank my friend.
No chance of pulling the title aswell? :-o
you can use sessions to do this
first you have to start the session in the beginning on each of your pages
<?php session_start(); ?>
in your loop, if there is a title, you have to put it into a session variable
<?php if(isset(the_title())){
$_SESSION['title'] = the_title();
} ?>
you can display it using an echo on the other pages
<?php echo $_SESSION['title']; ?>
warning : each time you go on the line
$_SESSION['title'] = the_title();
you will replace the value of the variable
so you will have to use it before to come into the loop or to put it into a new variable in the beginning of your page
<?php if(isset($_SESSION['title'])){$last_title = $_SESSION['title'];}?>
hope you will understand everything (if my english seems weird, it's because I'm french =p)
I've not try the code, maybe it's not working =S ! but I think you can find tuto about php sessions everywhere
This topic has been closed to new replies.