Jump to content

PuddleJumper9

New Members
  • Posts

    6
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

PuddleJumper9's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. I found the problem. With both of those JS referenced in the If Else statement, I have a form also. I had somehow forgot to close them off </form> :-( All working now!!!! Yippy
  2. - Thanks for the advice, I will work through it tonight. Maybe I will figure something out.
  3. Hi again :-( - The DIV thing, yeah I guess i should switch over, but I will have to do that later, - I originally believed it was because of the Submit button, but I couldn't explain why the form submission works without the PHP if , else statement. - I am not sure if I want the $_SESSION['SESS_MEMBER_ID'] to be set any other way than if the person is already logged in from a previous page. The page we are dealing with (contact.php) doesn't require a user to be logged in, but only needs to display the relevant menu options in case that person is logged in. - So I do expect isset($_SESSION['SESS_MEMBER_ID']) to be negative if the user is not logged in. - I guess that is as clear as mud :-) but this is going on now for 3 weeks or so, quite frustrating.
  4. - Thanks for your efforts here. - I tried as you showed, and the same result....I get kicked back to the Index.php, instead of my form getting submitted. The php code I used now is: <?php if (isset($_SESSION['SESS_MEMBER_ID'])){ echo '<script type="text/javascript" src="menu_horz.js"></script>'; } else { echo '<script type="text/javascript" src="log_menu_horz.js"></script>'; } ?>
  5. - My understanding is the slashes are required to Escape the double quotes. Otherwise the Echo statement would not know where the end of the statement is...i believe. - I did try using single quotes on the Echo, as PHP interprets them differently, depending on variables and literal strings. But I think for Escaping special characters the double quotes are needed. - The weird thing though, in each PHP page I have, I also use another PHP part that does something similar, but it doesn't have an issue with the form/submit pages. The PHP part that does not affect form/submit is below: <?php if (isset($_SESSION['SESS_MEMBER_ID'])){ echo "<script language=\"JavaScript\" type=\"text/javascript\" src=\"member-left.js\"></script>"; echo "<br />"; } ?> The only real difference is there is no Else statement, only the If statement.
  6. Hi Guys, I am fairly new to PHP, and I recently changed my whole site to use PHP sessions, which worked fine. Then I added PHP parts in my pages that display different menu choices depending on if a PHP session exists. This also works fine, until I found that any HTML/PHP pages that have form/submits no longer work, and I get kicked back to the index.php After slow backtracking, I removed new parts, and found the forms started working again if I removed the PHP part that chooses which JavaScript file to reference, as follows from contact.php <?php if (isset($_SESSION['SESS_MEMBER_ID'])){ echo "<script language=\"JavaScript\" type=\"text/javascript\" src=\"menu_horz.js\"></script>"; } else {echo "<script language=\"JavaScript\" type=\"text/javascript\" src=\"log_menu_horz.js\"></script>"; } ?> I tried changing the echo ".." to use single quotes ' ' instead, but then it doesn't work at all then with a form or no form on the page. I assume I am doing something wrong, but I can't find any resources that give me a definitive way of referencing Javascript files. What freaked me out was only the ones with forms were an issue. I am using <?php session_start(); ?> at the beginning of every page (before any output). Other PHP code on the page is working fine. Only the above part seems to be the problem, and works too, as long as I don't submit a form. - Could it be more weirder :-) - I tried also to find a workaround, but it would mean having PHP inside my JavaScript file, but I am not sure it would work, since JS is client side, and PHP server... Essentially, I just want to run certain JS menus depending if the person is logged in or not. - Example contact.php attached Any ideas of what the problem might be with the code above? Will be grateful for any help you can give. Regards D [attachment deleted by admin]
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.