2008/7/24, Marco Branco :
>
> hi
>
> i have this link in a web page (www.mydomain.com/index.php?id=2).
>
> and in the index.php i have
>
> <?php
> (...)
> switch ($id)
> {
> case 1: echo('um - 1'); break;
> case 2: echo('dois - 2'); break;
> case 3: echo('tres - 3'); break;
> default: echo('defaulf - any');
> }
> (...)
> ?>
>
> I alwys get the last line of the switch: *default - any*
>
> Why?
>
> thank's in advance
>
>
--
Regards,
---
Angga Sanjaya Lingga
-------------------------------
Dear Marco Branco,
Could you try this code :
<?php
(...)
$id = $_GET["id"];
/* Because the default value of $id has been not described. */
switch ($id)
{
case 1: echo('um - 1'); break;
case 2: echo('dois - 2'); break;
case 3: echo('tres - 3'); break;
default: echo('defaulf - any');
}
(...)
?>