0
 <?php
 include 'db.php';
 $mail=$_SESSION['session_u_e_mail'];
if(!isset($_GET['edit']))
{
$_GET['edit']=0;
}
switch($_GET['edit'])
{
 case 1: echo "Value";
         break;

 case 2: echo "Value";
         break;

 default: echo "Value";
         break;

 }

I m facing problem that the values in every case is echoed twice.

2
  • Are you certain the problem comes from those lines and not something after that? Commented Jul 23, 2011 at 12:37
  • @user855360: No, it doesn't. Make a testcase that demonstrates the issue. Commented Jul 23, 2011 at 12:40

2 Answers 2

2

I've just grabbed the

if(!isset($_GET['edit']))
{
$_GET['edit']=0;
}
switch($_GET['edit'])
{
 case 1: echo "Value";
         break;

 case 2: echo "Value";
         break;

 default: echo "Value";
         break;

 }

this portion and pasted onto codepad and it works fine.

Here is the working version: http://codepad.org/P8bhL5vl

It outputs just "Value".

Sign up to request clarification or add additional context in comments.

1 Comment

Probably your code going bad in your db.php file. Check that out and you will find the problem.
0

There is nothing in this code that would even output your default value. No matter the input, this outputs Value. Look in db.php or the files included by it for debugging echoes.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.