Jump to content

[SOLVED] if (isset($section) && $section != "")


Recommended Posts

hi i am a newbie and ive been workin my way threw the php manual on php.org and my old highschool used php then moved to asp so i got the old home page and it work up to the links and im not sure what to do  the block is

 

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

 

im not sure were to set $section were $page comes in or how to keep the page from auto shoing a set page ( $section ) rather than welcome.php

 

if you need to see the pages eintire pages script email me at [email protected]

Link to comment
https://forums.phpfreaks.com/topic/36683-solved-if-issetsection-section/
Share on other sites

well they called it a content box they had a row of links  and when you clicked on one it opens the content in the table thats were you find the block of code i posted  and im not sure were the variables ( $section and $page ) should be set or how  it seems to me thats what the code looks for because when i write

<?php $section = 'Enrollment.php'; ?>

on load it replacies welcome.php with Enrollment.php and thats not what i want what i want is when i click on a link it replaces it

 

 

lol im sorry i suck a explaining things no i didnt download this code a friend wrote it for my old highschool

 

uhm ok here is the eintire code for index.php

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">

<html>

<head>

  <title>East Baton Rouge Arts and Technology School</title>
  
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">















<STYLE type="text/css">

body, td 
{ 
font-size: 8pt; font-family:verdana; 
}

A:link, 
A:visited 
{ 
text-decoration: none; 
color: DBCB53;
}

A:hover 
{  
text-decoration: none; 
color: #00FFFF; 
background-color: 640709; 
}

div.Section1
{
page:Section1;
}

body 
{
background-color: #892627;
}
  
div.Section1
{
page:Section1;
}
.style1 {font-weight: bold}
</STYLE>

<script type="text/javascript"
src="udm-resources/udm-custom.js"></script>
<script type="text/javascript"
src="udm-resources/udm-control.js"></script>
<script type="text/javascript"
src="udm-style.js"></script>
</head>

<body 
bgcolor="#CBD4E4" 
text="DBCB53" 
leftmargin="0" 
topmargin="0" 
marginwidth="0" 
marginheight="0" 
link="#DBCB53" 
vlink="#DBCB53" 
alink="#DBCB53">

<script 
type="text/javascript"
src="udm-resources/udm-dom.js">
</script>
<div align="center">
  <table width="716" cellspacing="0" cellpadding="0">
    <tr>
      <td><table width="716" cellspacing="0" cellpadding="0">
        <tr>
          <td height="64"> <?php if (isset($section2) && $section2 != "") 
{ include("/Inetpub/wwwroot/test1".$section2."".$page.".php");} 
else 
{$number = "2"; include 'announcements/show_news.php';} ?> </td>
           
          <td width="134"><div align="right"></div></td>
        </tr>
      </table></td>
    </tr>
    <tr>
      <td height="175"><a href="index.php"></a></td>
    </tr>
    <tr>
      <td height="20"><table width="716" cellspacing="0" cellpadding="0">
        <tr>
          <td width="42"> </td>
          <td width="674">
	  
          <ul id="udm" class="udm">
            <li><a class="nohref"></a>
                <ul>
                  <li><a href="?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>
        </tr>
      </table></td>
    </tr>
    <tr>
      <td height="11"> </td>
    </tr>
    <tr>
      <td><table width="716" cellspacing="0" cellpadding="0">
        <tr>
          <td width="11" background="images/ebrats_16.gif" ></td>
          <td width="491" valign="top" bgcolor="700A0C"><table width="491" cellspacing="0" cellpadding="0">
            <tr>
              <td height="20" valign="top" background="images/ebrats_21.gif" bgcolor="700A0C">                
		  <table width="96%" align="center" cellpadding="0"  cellspacing="0">
                  <tr>
                    <td height="26"><?php if (isset($section) && $section != "") 
{include($section."".$page.".php");} 
else
{$number = "1"; include 'welcome.php';} ?></td>
                </tr>
              </table></td>
            </tr>
            <tr>
              <td height="8"> </td>
            </tr>
          </table>
	  </td>
          <td width="11" bgcolor="700A0C"></td>
          <td width="183" valign="top" bgcolor="700A0C"><table width="182" cellspacing="0" cellpadding="0">
            <tr>
              <td height="18"> </td>
            </tr>
            <tr>
              <td valign="top" background="images/ebrats_22.gif" bgcolor="700A0C">
		  <table width="100%" cellpadding="0" cellspacing="0">
                <tr>
                  <td height="18">
	            <p><strong>Check out the discussion board under "News." </strong></p>
	            <p>Class sites are located under About Faculty. Please refresh Faculty pages each new visit to update changes.</p>
	            <p>We need help! Working on the building this summer. Work days all Saturdays this month. </p>
	            <p>Letters should have arrived regarding prep for new year. Please contact us if you haven't received info.</p></td>
                </tr>
              </table></td>
            </tr>
            <tr>
              <td height="33"> </td>
            </tr>
            <tr>
              <td valign="top" background="images/ebrats_22.gif" bgcolor="700A0C">
		  <table width="100%"  cellspacing="0" cellpadding="0">
                <tr>
                  <td height="18">
                          <p>101 St. Ferdinand<br>
                            at<br>
                            North Blvd<br>
                            Baton Rouge LA<br>
                          70802 </p></td>
                </tr>
              </table></td>
            </tr>
            <tr>
              <td height="32"> </td>
            </tr>
            <tr>
              <td height="118" valign="top" background="images/ebrats_22.gif" bgcolor="700A0C"><table width="100%" height="118" cellpadding="0"  cellspacing="0">
                <tr>
                  <td height="116"><p>Office: (225)-389-0868<br>
                      Fax: (225)-389-0834
                      </p>
                    <p>School Director<br>
                          <a href="mailto:[email protected]">[email protected]</a> </p>
                    <p><a href="http://www.ebrats.org/Faculty/kcduke/Home.htm">Link to Ms. Duke's webpage</a></p>
                    <p> </p>
                    </td>
                </tr>
              </table></td>
            </tr>
            <tr>
              <td height="8"> </td>
            </tr>
          </table></td>
          <td width="20" background="images/ebrats_20.gif" ></td>
        </tr>
      </table></td>
    </tr>
    <tr>
      <td height="34"> </td>
    </tr>
    <tr>
      <td background="images/ebrats_33.gif" ><table width="92%" align="center" cellpadding="0"  cellspacing="0">
        <tr>
          <td> </td>
        </tr>
      </table>      
  </td>
    </tr>
    <tr>
      <td height="20"> </td>
    </tr>
  </table>
<p> </p>
</div>

</body>
</html>

 

i looked at for a while and i gues what im asking is how can i use a link to set the $section

By looking at the script those variables are coming from the URL. Change $section, $section2 and $page to $_GET['section'], $_GET['section2'] and $_GET['page'] respectively.

 

The script was most probably coded with register_globals enabled.

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.