Jump to content

query string use (I have read post'help with query strings in html but..)


jimmyborofan

Recommended Posts

okay I have generally used classic asp previously and my next (and future modules) deal only with PHP, which is unfortunate for me as I don't have a clue...

 

The only way I know how to give an example of this is in asp and I hope that someone out there knows what I need!

 

 

Any way I need to create a few pages and for the sake of code reuse I want to do this in a particular way, now if I was to create the links that I want in classic asp I would create two pages like this:

link.asp:

<p><a href="contact.asp?id=feedback">Feedback</a></p>

<p> href="contact.asp?id=contact">Contact</a></p>

 

this first would provide the links to this page:

 

contact.asp:

<html>

<body>
<%
Dim  strErrType, strHeadline, strMessage

'get the error type
strErrType = Request.QueryString("id")

'test the error type
Select Case strErrType
Case "contact"

strHeadline = "<h3>Hello!</h3>"
strMessage = "<p>You have chosen the Contact link.</p>"


Case "feedback"
strHeadline = "<h3>Hello!</h3>"
strMessage = "<p>You have chosen the feedback link.</p>"
End Select
%>
<%=strHeadline%>
<%=strMessage%>
</body>
</html>

 

now when the link is sent to contact.asp it chooses which CASE has been sent through and displays the relevant info.

 

if you choose contact.asp?id=feedback you would get the feedback message etc, both sent to the same page but depending upon the query string, displays a different message.

 

 

(if you copy both these pages and run them as named through IIS or apache with asp installed, they will work and show what I mean)

 

I hope that this is clear enough!

 

So I need to do the equivalent in PHP, please can anyone put me (or push me) in the right direction so that I can do this please!

 

 

with thanks in advance

 

 

Jimmy

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.