...

View Full Version : Converting a PHP file to ASP?



tylerh
12-24-2007, 12:13 AM
I was wondering if I could convert this php file to asp.. Here's the code


<?php
$id = $_GET['id'];
?>
<?php
if ($id=="")
{
?>
<li><a href="layouts.php?id=1">Layout 1</a></li>
<li><a href="layouts.php?id=2">Layout 2</a></li>

<?php
}
if ($id=="1")
{
?>

layout 1

<?php
}
if ($id=="2")
{
?>

layout 2

<?php
}
end
?>


Thanks!

shyam
12-24-2007, 09:30 AM
I was wondering if I could convert this php file to asp..
absolutely

query string variables are accessed using the Request.QueryString(varName) and the if-then construct is as follows


if t = "" then
end if

tylerh
12-25-2007, 01:16 AM
I tried this but i got an error
I'm a n00b at asp coding
haha



<%
Request.QueryString(id)
if id = "" then
response.write("<a href='test.asp?id=1'>1</a> ;;;; <a href='test.asp?id=2'>2</a>")
end if
id id="1" then
response.write("lol")
end if
if id="2" then
response.write("rofl")
end if
%>


:\

reubenb
01-03-2008, 05:28 AM
Try


<%
Dim t
t = Request.QueryString("id")
if t = "" then
response.write("<a href='test.asp?id=1'>1</a> ;;;; <a href='test.asp?id=2'>2</a>")
end if
if t="1" then
response.write("lol")
end if
if t="2" then
response.write("rofl")
end if
%>

ghell
01-12-2008, 07:04 PM
I'm not normally one for doing things for people rather than telling them how to do it, but as it is so simple:
<&#37;
id = Request.QueryString("id")
Select Case id
Case "1"
Response.Write "Layout 1"

Case "2"
Response.Write "Layout 2"

Case Else
%>
<li><a href="layouts.asp?id=1">Layout 1</a></li>
<li><a href="layouts.asp?id=2">Layout 2</a></li>
<%

End SelectThis could have been done with
If ... Then
...
Else If ... Then
...
Else If ... Then
...
Else
...
End Ifbut Select Case makes this simpler.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum