Hi!
I need to know how we do ?id= thing in PHP. I know how to do it in ASP. In ASP, we do it like:
<%
If Request.QueryString("id")="" Then
%>
DEFAULT TEXT
<%
End If
If Request.QueryString("id")="car" Then
%>
CAR PAGE
<%
End If
If Request.QueryString("id")="bus" Then
%>
BUS PAGE
<%
End If
%>
When we type PAGE.asp?id=car, the car page appears. I just need to know how we do it in PHP. Please tell me.
Thanks.
PHP ?id= SYSTEM
Moderator: General Moderators
Direct conversion (assuming asp styles tags are off):
But what I think you need is:
Please see:
http://www.php.net/manual/en/control-structures.php
http://www.php.net/manual/en/control-st ... s.else.php
http://www.php.net/manual/en/language.v ... efined.php
Regards,
Code: Select all
<? if($_GET['id'] == "") { ?>
DEFAULT TEXT
<? } if($_GET['id'] == "car") { ?>
CAR PAGE
<? } if($_GET['id'] == "bus") { ?>
BUS PAGE
<? } ?>Code: Select all
<?php
if($_GET['id'] == "")
{
echo "DEFAULT TEXT";
} elseif($_GET['id'] == "car") {
echo "CAR PAGE";
} elseif($_GET['id'] == "bus") {
echo "BUS PAGE";
}
?>http://www.php.net/manual/en/control-structures.php
http://www.php.net/manual/en/control-st ... s.else.php
http://www.php.net/manual/en/language.v ... efined.php
Regards,