/    Sign up×
Community /Pin to ProfileBookmark

[HELP] switch case url with php.

index.php

<!DOCTYPE html>
<html>
<head>
<meta http-equiv=”Content-Type” content=”text/html; charset=utf-8″>
<p>&#272;ây là trang ch&#7911;</p>
</head>
<body>
<div method=get action=”trang.php”>
<ul>
<li><a href=”” name=index>Trang Ch&#7911; </a></li>
<li><a href=”” name=ab>Gi&#7899;i Thi&#7879;u </a></li>
<li><a href=”” name=ser>D&#7883;ch V&#7909;</a></li>
</ul>
</div>
</body>
</html>

action

<?php
$index = $_GET[“index”];
$ab = $_
GET[“ab”];
$ser = $_GET[“ser”];
$nar = array($index, $ab, $ser);
switch($nar) {

case ‘index’:
include(“./index.php”);
break;

case ‘ab’:
include(“./about-us.php”);
break;

case ‘ser’:
include(“./service.php”);
break;
}

?>

to post a comment
PHP

1 Comments(s)

Copy linkTweet thisAlerts:
@NogDogOct 28.2013 — Do you have some question you want to ask related to that code? (PS, if you make use of this forum's [noparse][code=php], [code=html], and [code][/noparse] tags, it will be easier for us to read your code.)
×

Success!

Help @timberlake520 spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.19,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...