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
https://forums.phpfreaks.com/topic/262117-cant-get-it-to-work-why/
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.

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

Archived

This topic is now archived and is closed to further replies.

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