Undefined variable

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
mattmcb
Forum Commoner
Posts: 27
Joined: Sun Jan 25, 2004 3:34 pm

Undefined variable

Post by mattmcb »

I'm receiving this error:

Notice: Undefined variable: v in c:\program files\apache group\apache\htdocs\index.php on line 19

Code: Select all

// Main
***LINE 19*** switch($v) {
	case "site_mission":
		include("dsp_site_mission.php");
		break;
		
	case "resources":
		include("dsp_resources.php");
		break;
		
	case "surveys":
		include("dsp_surveys.php");
		break;
		
	case "shopping":
		include("dsp_shopping.php");
		break;
		
	case "links":
		include("dsp_links.php");
		break;
	
	case "about":
		include("dsp_about.php");
		break;
		
	case "suggest_topic":
		include("dsp_suggest_topic.php");
		break;
		
	case "search_site":
		include("dsp_search_site.php");
		break;
		
	case "contact":
		include("dsp_contact.php");
		break;
	
	case "report_problem":
		include("dsp_report_problem.php");
		break;
	
	case "wow":
		include("dsp_wow.php");
		break;
		
	case "feedback":
		include("dsp_feedback.php");
		break;
	
	case "faq":
		include("dsp_faq.php");
		break;
		
	default:
	  include("dsp_home.php");
	  break;
  
	case "test":
		include("test1.php");
		break;
}


Can anyone help?
d3ad1ysp0rk
Forum Donator
Posts: 1661
Joined: Mon Oct 20, 2003 8:31 pm
Location: Maine, USA

Post by d3ad1ysp0rk »

post whats above line 19 please (ie. all the code up to 19 :P )

The problem is you arent declaring it.

Code: Select all

<?php
$v = $_GET['v'];
OR
$v = $_POST['v'];
?>
depending on the method your form uses..

Code: Select all

&lt;form method="get" action="page.php"&gt;
or 
&lt;form method="post" action="page.php"&gt;
Post Reply