Jump to content

cant get it to work !!! why?


jac.kock

Recommended Posts

hi all,

 

i have been struckling with this code of mine :)

 

i want when i click a link to change the setting for the menu (see code)

 

<? echo "[".$_SESSION['menu']."]"; ?>
<table class="border_test">
  <tr>
    <td valign="top" align="left">
      <!-- menu items: menu -->
      <img src="../design/item.png" width="10" height="10"><a href="<?=$_SERVER['REQUEST_URI'];?>" onclick="<? $_SESSION['menu']=1;?>"><b> Site menu:</b></a>
    </td>
  </tr>
  <? if($_SESSION['menu']==1) { echo '
  <tr>
    <td>
         <img src="../design/subitem.png" width="10" height="10"> <a href="?topic=add_menu">Toevoegen menu item.</a><br>
         <img src="../design/subitem.png" width="10" height="10"> <a href="?topic=edit_menu">Bewerken menu item.</a><br>
         <img src="../design/subitem.png" width="10" height="10"> <a href="?topic=del_menu">Verwijderen menu item.</a>
    </td>
  </tr>'; } ?>
  <tr>
<td>
      <!-- menu items: submenu -->
      <img src="../design/item.png" width="10" height="10"><a href="<?=$_SERVER['REQUEST_URI'];?>" onclick="<? $_SESSION['menu']=2;?>"><b> Site submenu:</b></a>
    </td>
  </tr>
  <? if($_SESSION['menu']==2) { echo '
  <tr>
    <td>
         <img src="../design/subitem.png" width="10" height="10"> <a href="?topic=add_submenu">Toevoegen submenu item.</a><br>
         <img src="../design/subitem.png" width="10" height="10"> <a href="?topic=edit_submenu">Bewerken submenu item.</a><br>
         <img src="../design/subitem.png" width="10" height="10"> <a href="?topic=del_submenu">Verwijderen submenu item.</a>
    </td>
  </tr>'; } ?>
  <tr>
    <td>
      <!-- menu items: Pagina's -->
      <img src="../design/item.png" width="10" height="10"><a href="<?=$_SERVER['REQUEST_URI']; ?>"><b> Pagina's:</b></a>
    </td>
  </tr>
</table>

 

so what it wil do is show the subitem list of the main menu item when de var is changed!

 

butt when i use it it always set to the last ( in this case to: 2 ) even when i click the first link to set it to 1 :(

 

can somebody help me to get it to work?

 

 

thnx,

 

Link to comment
Share on other sites

Why are you using session?

 

Maybe you want to use $_GET?

but then you need to change the urls to "?menu=1" or "?menu=2", instead of $_SERVER['REQUEST_URI']. Of course also use $_GET instead of $_SESSION!

Link to comment
Share on other sites

Why are you using session?

 

because i thought it was handy in the main index i use session_start() suggestions?

 

thnx

Might be something I'm missing, but I honestly don't see how you set or change the session data. Some of your code is missing.

You could do as I said, use GET to fetch the change and then use it to set the session data.

Link to comment
Share on other sites

Why are you using session?

 

because i thought it was handy in the main index i use session_start() suggestions?

 

thnx

Might be something I'm missing, but I honestly don't see how you set or change the session data. Some of your code is missing.

You could do as I said, use GET to fetch the change and then use it to set the session data.

 

oke any suggestions to make it work what i want to do?? any examples??

 

thnx

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.