Quantcast
Channel: WordPress.org Forums » All Topics
Viewing all articles
Browse latest Browse all 59525

format of URL with variables altered

$
0
0

Replies: 0

Hi guys, I am trying to set up a page with a conditional logic in it. Please see below:


<?php
/*
template name:  myapge temp
*/

if (isset($_GET['page'])&&!empty($_GET['page'])) {
	$page  = $_GET['page'];
} else {
	$page=1;
};
?>

<!DOCTYPE html>
<html>
<head>
	<meta name="viewport" content="width=device-width">
</head>
<body>
<p> how are you?
<a href="mypage?page=1">1</a>
<a href="mypage?page=2">2</a>
</p>
</body>
</html>

I am expecting to get a URL like
http://localhost/testsite.com/mypage?page=1
or
http://localhost/testsite.com/mypage?page=2

To get $_GET[‘page’].

but I got
http://localhost/testsite.com/mypage/1
http://localhost/testsite.com/mypage/2
instead.

Why? please help!
Thanks a lot!

James


Viewing all articles
Browse latest Browse all 59525

Trending Articles