Jump to content

Newbie. Need some help?


hudsonpi

Recommended Posts

I'm sorry. should of posted some code.

I don't know much about php quite yet, but I'm learning.

 

Here is the switch:

 

switch($page)

{

case "news":

	include_once("news.php");

	break;

case "careers":

	include_once("careers.php");

	break;

case "outsource":

	include_once("outsource.php");

	break;

case "investor":

	include_once("investor.php");

	break;

case "products":

	include_once("products.php");

	break;

case "about":

	include_once("about.php");

	break;

default:

	include_once("news.php");

}

 

Hopefully this helps. thanks so much!

Link to comment
https://forums.phpfreaks.com/topic/55505-newbie-need-some-help/#findComment-274320
Share on other sites

In the absence of code to tell us how you determine the value of $page, I'll assume that you think (or have coded as if) register_globals is ON - whereas the normal current and more secure setting is register_globals OFF.  If you don't already do this, precede your switch statement by retrieving the passed value of page from the $_GET array:

 

<?php
$page = $_GET['page'];
switch($page)
.... etc ...
?>

Link to comment
https://forums.phpfreaks.com/topic/55505-newbie-need-some-help/#findComment-274322
Share on other sites

Instead of showing you in pieces, I will include the whole source. It also includes the value of $page.

Here is the entire index.php source PHP:

 

<?php 



include_once("functions.php");



if(isset($_GET['page']))

{

display_header($_GET['page']);

}

else

{

display_header("news");

}



$html .= "<body onload=\"MM_preloadImages('images/menu_careers_red.gif','images/menu_about_red.gif','images/menu_outsource_red.gif','images/menu_contact_red.gif','images/menu_news_red.gif','images/menu_products_red.gif','images/menu_investor_red.gif',

	'images/menu_careers.jpg','images/menu_about.jpg','images/menu_outsource.jpg','images/menu_contact.jpg','images/menu_news.jpg','images/menu_products.jpg','images/menu_investor.jpg', 'images/menu_spacer.jpg', 'images/menu_left.jpg')\">";



$html .= "<table width=\"100%\"><tr><td align=\"center\">";



$html .= "<div class=\"content\">";

$html .= "<div class=\"header\">";

$html .= "<img src=\"images/logo.jpg\" />";

$html .= "</div>";



// Menu

$html .= "<div class=\"menu\">";

$html .= "<img src=\"images/menu_left.jpg\" />";

$html .= "<a href=\"index.php?page=news\" onMouseOver=\"imageRollover(document.getElementById('news_button'), 'images/menu_news_red.gif');\" onMouseOut=\"imageRollover(document.getElementById('news_button'), 'images/menu_news.jpg');\">";

$html .= "<img name=\"news_button\" id=\"news_button\" src=\"images/menu_news.jpg\"/></a>";

$html .= "<img src=\"images/menu_spacer.jpg\" />";

$html .= "<a href=\"index.php?page=about\" onMouseOver=\"imageRollover(document.getElementById('about_button'), 'images/menu_about_red.gif');\" onMouseOut=\"imageRollover(document.getElementById('about_button'), 'images/menu_about.jpg');\">";

$html .= "<img name=\"about_button\" id=\"about_button\" src=\"images/menu_about.jpg\"/></a>";

$html .= "<img src=\"images/menu_spacer.jpg\" />";

$html .= "<a href=\"index.php?page=outsource\" onMouseOver=\"imageRollover(document.getElementById('outsource_button'), 'images/menu_outsource_red.gif');\" onMouseOut=\"imageRollover(document.getElementById('outsource_button'), 'images/menu_outsource.jpg');\">";

$html .= "<img name=\"outsource_button\" id=\"outsource_button\" src=\"images/menu_outsource.jpg\"/></a>";

$html .= "<img src=\"images/menu_spacer.jpg\" />";

$html .= "<a href=\"index.php?page=products\" onMouseOver=\"imageRollover(document.getElementById('products_button'), 'images/menu_products_red.gif');\" onMouseOut=\"imageRollover(document.getElementById('products_button'), 'images/menu_products.jpg');\">";

$html .= "<img name=\"products_button\" id=\"products_button\" src=\"images/menu_products.jpg\"/></a>";

$html .= "<img src=\"images/menu_spacer.jpg\" />";

$html .= "<a href=\"index.php?page=investor\" onMouseOver=\"imageRollover(document.getElementById('investor_button'), 'images/menu_investor_red.gif');\" onMouseOut=\"imageRollover(document.getElementById('investor_button'), 'images/menu_investor.jpg');\">";

$html .= "<img name=\"investor_button\" id=\"investor_button\" src=\"images/menu_investor.jpg\"/></a>";

$html .= "<img src=\"images/menu_spacer.jpg\" />";

$html .= "<a href=\"index.php?page=careers\" onMouseOver=\"imageRollover(document.getElementById('careers_button'), 'images/menu_careers_red.gif');\" onMouseOut=\"imageRollover(document.getElementById('careers_button'), 'images/menu_careers.jpg');\">";

$html .= "<img name=\"careers_button\" id=\"careers_button\" src=\"images/menu_careers.jpg\"/></a>";



$html .= "</div>";



switch($page)

{

case "news":

	include_once("news.php");

	break;

case "careers":

	include_once("careers.php");

	break;

case "outsource":

	include_once("outsource.php");

	break;

case "investor":

	include_once("investor.php");

	break;

case "products":

	include_once("products.php");

	break;

case "about":

	include_once("about.php");

	break;

default:

	include_once("news.php");

}



$html .= "</div>";

$html .= "<div class=\"content\">";

$html .= "<img src=\"images/copyright.jpg\" />";

$html .= "</div>";

$html .= "</td></tr></table>";

$html .= "</body>";

$html .= "</html>";

echo $html;

?>

Link to comment
https://forums.phpfreaks.com/topic/55505-newbie-need-some-help/#findComment-274325
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.