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

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
grudz
Forum Commoner
Posts: 68
Joined: Thu Dec 04, 2003 12:52 pm

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

Post 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
User avatar
voodoo9055
Forum Commoner
Posts: 51
Joined: Sat Apr 26, 2003 3:27 pm
Location: Montgomery, AL

Post by voodoo9055 »

You want to set the height and width of what????

Post some code.
grudz
Forum Commoner
Posts: 68
Joined: Thu Dec 04, 2003 12:52 pm

Post 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
User avatar
voodoo9055
Forum Commoner
Posts: 51
Joined: Sat Apr 26, 2003 3:27 pm
Location: Montgomery, AL

Post 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.
grudz
Forum Commoner
Posts: 68
Joined: Thu Dec 04, 2003 12:52 pm

Post by grudz »

i need to pass a $_SERVER['HTTP_REFERER'] ......and it wont if i use javascript....any ideas?
User avatar
voodoo9055
Forum Commoner
Posts: 51
Joined: Sat Apr 26, 2003 3:27 pm
Location: Montgomery, AL

Post 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>
...........
User avatar
mikusan
Forum Contributor
Posts: 247
Joined: Thu May 01, 2003 1:48 pm

Post 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.
grudz
Forum Commoner
Posts: 68
Joined: Thu Dec 04, 2003 12:52 pm

Post by grudz »

if i do that....its actually going to give me "$_SERVER['HTTP_REFERRER']" not what it means
User avatar
voodoo9055
Forum Commoner
Posts: 51
Joined: Sat Apr 26, 2003 3:27 pm
Location: Montgomery, AL

Post by voodoo9055 »

(' . $_SERVER['HTTP_REFERRER'] . ')

not

( $_SERVER['HTTP_REFERRER'] )
User avatar
Pointybeard
Forum Commoner
Posts: 71
Joined: Wed Sep 03, 2003 7:23 pm
Location: Brisbane, AUS
Contact:

Post by Pointybeard »

try <?= $_SERVER['HTTP_REFERRER'] ?> instead. ;) EG:

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