xPenxdosaxAvatar border
TS
xPenxdosax
Php case switch break
Para master coder. boleh tanya seputar PHP CASE

begini saya punya index (_parent) yang bermuatan php case untuk memanggil halaman yang dituju.

tapi di halaman yang dituju (_child) ada php case juga. udah bebagai cara sesuai kemampuan ga dapet dapet.

Index.php

PHP Code:
<div><a href="?id=child">Link 1</a> | <a href="?id=child2">Link 2</a></div><br /><br />
$id = @$_GET[&#039;id']; 

if(empty($id) || $id 3) { 
   include_once(
"child.php");  
} else {  
   switch (
$id) {  
       case 
"child":  include_once("child.php"); break;  
   case "child2":  include_once("child2.php"); break;  
   }  



child.php

PHP Code:
ALOHA 


child2.php

PHP Code:
$titAboutIndo "Tentang Kami"
$titAboutEng "About us"

function 
indoabout() { 
    echo 
"Halo Dunia!";


function 
engabout() { 
    echo 
"Hello world!";


if (isset(
$_GET[&#039;run'])) $linkchoice=$_GET['run'];  
else $linkchoice=&#039;';  

switch($linkchoice){  

case &
#039;indonesia' : 
       
echo "<div>".$titAboutIndo"</div><div><a href=?run=indonesia>indo</a> <a href=?run=english>eng</a></div>";
indoabout();
break;  

case &
#039;english' : 
       
echo "<div>".$titAboutEng"</div><div><a href=?run=indonesia>indo</a> <a href=?run=english>eng</a></div>";
engabout();
break;   

default :  
case &
#039;indonesia' : 
       
echo "<div>".$titAboutIndo"</div><div><a href=?run=indonesia>indo</a> <a href=?run=english>eng</a></div>";
indoabout();
break;   



Hasil eksekusi pada child2.phptidak terjadi apa apa.
malah balik ke index.php dan menampilkan child.php
kira kira apa masalahnya ya?

Terima kasih suhu. maaf kalo codenya culun bin katrok. maklum ane newbie.
Thanks before.
0
751
4
GuestAvatar border
Guest
Tulis komentar menarik atau mention replykgpt untuk ngobrol seru
Urutan
Terbaru
Terlama
GuestAvatar border
Guest
Tulis komentar menarik atau mention replykgpt untuk ngobrol seru
Komunitas Pilihan