Page 1 of 1
order for return link??
Posted: Wed Mar 31, 2004 12:55 am
by southeastweb
I have searched far and low, but cannot seem to find a function return href function to create a link back to the order enter page. see the 3rd echo, I just can't figure this out, ive tried more than 20 variations of href and code code formats, thanks in advance for any advice. J
//Order error checking
if(totaqty == 0)
{
echo "<font color=red>";
echo "<p><strong>You did not order anything on the previous
echo "<a href=
http://localhost, Return</a>";
}
Link back
Posted: Wed Mar 31, 2004 1:25 am
by Pozor
Hello,
You want to go back on the page you was before?
try $_SERVER['REQUEST_URI']; //back reference to the last page
//Order error checking now with minor changes
if(totaqty == 0)
{
echo '<font color=red>';
echo '<p><b>You did not order anything on the previous</b></p>';
echo '>/font>';
//echo '<a href="http://localhost">Return</a>';
echo '<a href="'.$_SERVER['REQUEST_URI'].'">Return</a>';
}
use ' instead of " if you dont use variables within the strings -> its faster
When you want the same effect like the browser support (back button) use javascript.
Usually is this not a good solution -> not well controllable how the browser handle this...
Or try this ->
<?php
// print the hole $_SERVER array -> there you can find useful infos for creating backlinks...
print_r($_SERVER);
?>
greez Pozor
Thanks for the info
Posted: Wed Mar 31, 2004 1:45 am
by southeastweb
The "return" link was now viewable, and hot, but only returned to the existing page, I viewed and tried several print_r($_SERVER); functions as you mentioned, but all I could acheive was returning to my index page. the page i am returning to is just a single seperate file on my server.
Maybe I am missing something here, and maybe java is the real answer.
It's a bit late here, so my full function is low, thanks for your help and advice, I learned something new! If you have any other suggestions, please let me know.
Thanks!

Posted: Wed Mar 31, 2004 1:54 am
by Pozor
Hello,
Page now (who should have a linl back) = PN
that what i suggested before, was a solution to get to the previous page (that page you clicked on a link or on a submit button to get to the PN).
If you call this script by themself the link is a link that points on themself...
Maybe i missed what you wanted?? When yes can you point it out maybee with a link to the site who cause the problem?
greez Pozor
PS: Sorry my english isn't very well i'm still leraning

I am going to keep hacking at it
Posted: Wed Mar 31, 2004 2:00 am
by southeastweb
Maybe my question does not make sense?? Sorry for using so much english puctuation.
All I am trying to do is create a link to the previous page.
PageA PageB
I am trying to go back to PageB. PageA is the current page that will display the return link.
I hope this makes sense. What language do you speak? I have a translator that might make it easier to speak, your english seems pretty good to me! Thanks

Posted: Wed Mar 31, 2004 2:15 am
by Pozor
Hello,
my mother tongue is swiss german, but i speack german, and english too.
please dont try to translate english in german, this doesn't work well...
I think it is what i posted before...
file1: test_REFEREER.php
Code: Select all
<?php
echo '<a href="test_SERVER_var.php">Link zu file: test_SERVER_var.php</a>';
?>
file2: test_SERVER_var.php
Code: Select all
<?php
echo '<a href="'.$_SERVER['HTTP_REFERER'].'">Back Link</a>';
echo '<br><br>';
echo '<pre>';
print_r($_SERVER);
echo '</pre>';
?>
ok put this files on your local- or normal webserver (must be the same directory!), then start file1 and click on the link...
so i tested it.. it works fine. i think it is that what you wanted or not?
greez Pozor
//Edit sorry made a little mistake in file2 should be HTTP_REFERER instead of REQUEST_URI.... it's not my day, im ill -> got the flu

That works
Posted: Wed Mar 31, 2004 2:32 am
by southeastweb
Well, it worked. Below is my full snipet:
Thanks for your help, I wish I could return a code favor, but I think you know quite a bit more than me. If you don't currently use a PHP editing software I recommend Davor's PHP Editor (other languages too). Here is a link to download it, it's FREE:
http://download.com.com/3000-7957-10154 ... ag=lst-0-1
I have been using it, and my files are clean and organized.
//Order error checking
if($totalqty == 0)
{
echo "<font color=red>";
echo "<p><strong>You did not order anything on the previous page</strong></p>";
echo '<a href="bobs_home.php">Go Back</a>';
}
?>
Posted: Wed Mar 31, 2004 3:14 am
by Pozor
Hallo,
i use Source edit, a nice Text, C++, C, PHP and and... editor
with useful function like tab -> 2 spaces (or how many you want)
http://download.com.com/3000-2352-10213 ... ag=lst-0-2
and lately i tried a very useful tool! TortoiseCVS a nice Version management for all kind of skripts and other stuff...
greez Pozor