Click to See Complete Forum and Search --> : Using PHP in a Javascript Drop-down Menu?


MaineWebGirl
04-16-2003, 08:52 AM
I have a javascript menu that has this call (and many more similar) in it:
http://64.179.21.93/cgi-bin/nl/nldemo.bat?request_id=OSTKCAT&SESSION_NO=DDDDDFAD&BEG_CLASS=IAXSHN&END_CLASS=IPHXHN&LOC=WHS&DISP=Y&CLASS_MASK=I???HN


The SESSION_NO part of the above call gives our software the information it needs to know who the customer is and what their password is. If you have not logged in yet, you don't have a session number.

I would like the menu to check for a session number, and if there isn't one, to direct it to another page instead. That call would be: http://64.179.21.93/cgi-bin/nl/nldemo.bat?request_id=clogin

I was told that I could use PHP. Something like this:
<?
if (session_id=="){do thelogin ;}
?>

but I don't know anything about PHP at all. Even if that was exactly the right command I don't know where to put it.

PS If you try the first link with the session_no, it will probably be timed out.

Anybody have any ideas? THANKS!

DrDaMour
04-16-2003, 09:16 AM
first that's not really a javascript question, that's a php one and you should go to that forum to look for help. However what you're probalby looking for is a siteredirect. IF you have PHP installed on your server then doing something like this in your html file before the <html> tag

<?php

if ($_GET['SESSION_NO'] == ""){ // if Session_no is not set
print("Location: URL");

}

?>

change teh URL to the logon page

MaineWebGirl
04-16-2003, 09:19 AM
Thanks, I'll try that. This webdeveloper forum is the best I've used, and it didn't have a PHP option. If anybody can recommend a good PHP forum I'll try there too.