Jump to content

$_GET?


doddsey_65

Recommended Posts

I have some javascript for a tabbed interface in index.php. The content of each tab is in content.php which uses $_GET to define which tab is selected. But i want to include queries based on variables from index.php how would i do this?

 

here is the code for the tabbed interface:

 

<script language="JavaScript" type="text/javascript" src="<?php echo SITE_ROOT; ?>/js/ahahLib.js"></script> 
<script language="JavaScript" type="text/javascript"> 
function makeactive(tab) { 
document.getElementById("tab1").className = ""; 
document.getElementById("tab2").className = ""; 
document.getElementById("tab3").className = ""; 
document.getElementById("tab"+tab).className = "active"; 
callAHAH('includes/content.php?content= '+tab, 'content', 'Loading...', 'Error'); } 
</script> 

<ul id="tabmenu" > 
<li onclick="makeactive(1)">
<a class="" id="tab1">Account Information</a>
</li> 
<li onclick="makeactive(2)">
<a class="" id="tab2">Second Page</a>
</li> 
<li onclick="makeactive(3)">
<a class="" id="tab3">Third Page</a>
</li> 
</ul> 
<div id="content"></div> 

 

and the code in content.php

 

if ($_GET['content'] == 1) { echo 'Content for Page 1'; } 

if ($_GET['content'] == 2) { echo 'Content for Page 2'; }

if ($_GET['content'] == 3) { echo 'Content For Page 3'; } 

 

ive tried adding the variable $user_id to the content.php url as follows:

 

callAHAH('includes/content.php?user=$user_id&content= '+tab, 'content', 'Loading...', 'Error'); } 

 

but that just brought up an error.

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.