Jump to content

[SOLVED] seting the value of a $section useing a <a href=""></a> link


fbrown

Recommended Posts

i have some code that makes a content box

<?php if (isset($section) && $section != "") 
{include("/Inetpub/wwwroot/test1/".$section."".$page.".php");} 
else
{$number = "1"; include 'welcome.php';} ?>

 

my goal is to find a way to set $section to Enrollment

<?php $section = "Enrollment"; ?>

when somebody clicks on it so that the content box includes Enrollment.php now a friend gave me this code

and i am not sure why the index $page is there i dont see it to be needed but this is the set up i have for a test

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Untitled Document</title>
</head>

<body>
<table width="200" align="center">
  <tr>
    <td> </td>
    <td><ul id="udm" class="udm">
            <li><a class="nohref"></a>
                <ul>
                  <li><a href="">Enrollment</a></li>
                  <li><a href="">Courses</a></li>
                  <li><a href="">Faculty</a></li>
                  <li><a href="">Administration</a></li>
                  <li><a href="">History</a></li>
                  <li><a href="">Board of Directors</a></li>
                  <li><a href="http://www.doe.state.la.us/lde/bese/855.html" target="_blank">What is a Charter School?</a></li>
                  <li><a href="docs/charter.pdf">Ebrats Charter</a></li>
                </ul>
            </li>
            
            <li><a class="nohref"></a>
                <ul>
                  <li><a href="">Downtown</a></li>
                  <li><a href="">Partnerships</a></li>
                  <li><a href="">Service Learning</a></li>
                </ul>
            </li>
            
            <li><a class="nohref"></a>
                <ul>
                  <li><a href="">Student Life</a></li>
                  <li><a href="">Seniors</a></li>
                  <li><a href="">Juniors</a></li>
                  <li><a href="">Sophomores</a></li>
                  <li><a href="">Freshmen</a></li>
                  <li><a href="">Pictures</a></li>
                  <li><a href="">Internships</a></li>
                  <li><a href="">Student Handbook</a></li>
                  <li><a href="">Student Government</a></li>
                  <li><a href="">ATM Reps</a></li>
                  </ul>
            </li>
            
            <li><a class="nohref"></a>
                <ul>
                  <li><a href="">Committees</a></li>
                  <li><a href="">Volunteers</a></li>
                  <li><a href="">Announcements/Info</a></li>
                  <li><a href="">Comments/Questions</a></li>
               </ul>
           </li>
           
           <li><a class="nohref"></a>
               <ul>
                  <li><a href="">Art Program</a></li>
                  <li><a href="">Art Gallery</a></li>
                  <li><a href="">Technology Program</a></li>
                  <li><a href="">Tech Team</a></li>
                  </ul>
            </li>
            
            <li><a class="nohref"></a>
                <ul>
                  <li><a href="">Calendar</a></li>
                  <li><a href="forum/index.php">Message Board</a></li>
                  <li><a href="">Current Events</a></li>
                  </ul>
            </li>
            
            <li><a class="nohref"></a>
                <ul class="style1">
                  <li><a target=new href="http://webmail.ebrats.org:90/exchange">Web mail</a></li>
                  <li><a target=new href="http://www.ebrats.org:88/default.aspx">Share Point</a></li>
                  </ul>
            </li>
        </ul>        </td>
    <td> </td>
  </tr>
  <tr>
    <td height="222"> </td>
    <td><?php if (isset($section) && $section != "") 
{include("/Inetpub/wwwroot/test1/".$section."".$page.".php");} 
else
{$number = "1"; include 'welcome.php';} ?></td>
    <td> </td>
  </tr>
</table>
</body>
</html>

 

any thoughts ive seen it work but it was so long ago i cant remember how

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Untitled Document</title>
</head>

<body>
<table width="200" align="center">
  <tr>
    <td> </td>
    <td><ul id="udm" class="udm">
            <li><a class="nohref"></a>
                <ul>
                  <li><a href="<?php echo $_SERVER['PHP_SELF']; ?>?section=Enrollment">Enrollment</a></li>
                  <li><a href="">Courses</a></li>
                  <li><a href="">Faculty</a></li>
                  <li><a href="">Administration</a></li>
                  <li><a href="">History</a></li>
                  <li><a href="">Board of Directors</a></li>
                  <li><a href="http://www.doe.state.la.us/lde/bese/855.html" target="_blank">What is a Charter School?</a></li>
                  <li><a href="docs/charter.pdf">Ebrats Charter</a></li>
                </ul>
            </li>
            
            <li><a class="nohref"></a>
                <ul>
                  <li><a href="">Downtown</a></li>
                  <li><a href="">Partnerships</a></li>
                  <li><a href="">Service Learning</a></li>
                </ul>
            </li>
            
            <li><a class="nohref"></a>
                <ul>
                  <li><a href="">Student Life</a></li>
                  <li><a href="">Seniors</a></li>
                  <li><a href="">Juniors</a></li>
                  <li><a href="">Sophomores</a></li>
                  <li><a href="">Freshmen</a></li>
                  <li><a href="">Pictures</a></li>
                  <li><a href="">Internships</a></li>
                  <li><a href="">Student Handbook</a></li>
                  <li><a href="">Student Government</a></li>
                  <li><a href="">ATM Reps</a></li>
                  </ul>
            </li>
            
            <li><a class="nohref"></a>
                <ul>
                  <li><a href="">Committees</a></li>
                  <li><a href="">Volunteers</a></li>
                  <li><a href="">Announcements/Info</a></li>
                  <li><a href="">Comments/Questions</a></li>
               </ul>
           </li>
           
           <li><a class="nohref"></a>
               <ul>
                  <li><a href="">Art Program</a></li>
                  <li><a href="">Art Gallery</a></li>
                  <li><a href="">Technology Program</a></li>
                  <li><a href="">Tech Team</a></li>
                  </ul>
            </li>
            
            <li><a class="nohref"></a>
                <ul>
                  <li><a href="">Calendar</a></li>
                  <li><a href="forum/index.php">Message Board</a></li>
                  <li><a href="">Current Events</a></li>
                  </ul>
            </li>
            
            <li><a class="nohref"></a>
                <ul class="style1">
                  <li><a target=new href="http://webmail.ebrats.org:90/exchange">Web mail</a></li>
                  <li><a target=new href="http://www.ebrats.org:88/default.aspx">Share Point</a></li>
                  </ul>
            </li>
        </ul>        </td>
    <td> </td>
  </tr>
  <tr>
    <td height="222"> </td>
    <td><?php if (isset($section) && $section != "") 
{include("/Inetpub/wwwroot/test1/".$section."".$page.".php");} 
else
{$number = "1"; include 'welcome.php';}
$section = $_GET['section'];
?></td>
    <td> </td>
  </tr>
</table>
</body>
</html>

well i gues we are moving farword welcome.php isnt there now but this error is on the page

 

 

PHP Notice: Undefined variable: section in C:\Inetpub\wwwroot\test 1\Untitled-1.php on line 87 PHP Notice: Undefined variable: page in C:\Inetpub\wwwroot\test 1\Untitled-1.php on line 87 PHP Warning: include(/Inetpub/wwwroot/test1/.php) [function.include]: failed to open stream: No such file or directory in C:\Inetpub\wwwroot\test 1\Untitled-1.php on line 87 PHP Warning: include() [function.include]: Failed opening '/Inetpub/wwwroot/test1/.php' for inclusion (include_path='.;C:\php5\pear') in C:\Inetpub\wwwroot\test 1\Untitled-1.php on line 87

i got it to work i really didnt need $page or $section i gues the two would come in handy but idk

this is what i came up with and it works really nice

<?php if (isset($_GET['section']))  
{include($_GET['section'].".php");} 
else
{$number = "1"; include 'welcome.php';}

?>

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.