Page 1 of 1

forced to use javascript but i dont want to? what can php do

Posted: Fri Feb 13, 2004 1:07 pm
by grudz
i am passing variables from one page to the next. I need to use Javascript (because i want to set the height, width, etc.....) however, by using javascript, the variables from the first page dont pass onto the second. is there a way around this?

thanx

Posted: Fri Feb 13, 2004 1:10 pm
by voodoo9055
You want to set the height and width of what????

Post some code.

Posted: Fri Feb 13, 2004 1:13 pm
by grudz
the new window after they click, but not only that, stuff like not having a menu bar, etc........stuff that javascript does easily......but i dont want to use that

Posted: Fri Feb 13, 2004 1:19 pm
by voodoo9055
Oh now I understand. You want to pass some information from PHP to a new window. You are correct about using javascript to create the new window. Still need more information about what you are trying to do though. If it is a hyperlink, you might have to pass the PHP value in a JavaScript funtion.

Posted: Fri Feb 13, 2004 1:27 pm
by grudz
i need to pass a $_SERVER['HTTP_REFERER'] ......and it wont if i use javascript....any ideas?

Posted: Fri Feb 13, 2004 1:35 pm
by voodoo9055
This is a guess. I am not around any IDE to test this at the moment.

Code: Select all

<script language="JavaScript">
function MyFunction(value) &#123;

   // do something
   something = newwindow(blah blah blah)

&#125;
</script>
............




<a href="javascript:MyFunction(' . $_SERVER&#1111;'HTTP_REFERER'] . ')">My Hyperlink</a>
...........

Posted: Fri Feb 13, 2004 1:40 pm
by mikusan
You can also pass them onto the new window with the link, and fetch the info $_GET[''].
so:
javascript on click stuff="somenewwindow.php?ref=' . $_SERVER['HTTP_REFERRER'] ...

I am not sure, but you could probably use $_POST and some hidden fields.

Then again, it all depends what you are trying to do.

My preferred, is to use sessions. I have a database of sessions, and everything is passed through the session, so that the link remains free of random stuff.

Posted: Fri Feb 13, 2004 1:55 pm
by grudz
if i do that....its actually going to give me "$_SERVER['HTTP_REFERRER']" not what it means

Posted: Fri Feb 13, 2004 4:05 pm
by voodoo9055
(' . $_SERVER['HTTP_REFERRER'] . ')

not

( $_SERVER['HTTP_REFERRER'] )

Posted: Fri Feb 13, 2004 10:00 pm
by Pointybeard
try <?= $_SERVER['HTTP_REFERRER'] ?> instead. ;) EG:

<a href="javascript:MyFunction('<?= $_SERVER['HTTP_REFERER'] ?>')">My Hyperlink</a>