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
https://forums.phpfreaks.com/topic/215182-_get/
Share on other sites

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.