jimmyborofan Posted September 20, 2008 Share Posted September 20, 2008 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 Quote Link to comment https://forums.phpfreaks.com/topic/125075-query-string-use-i-have-read-posthelp-with-query-strings-in-html-but/ Share on other sites More sharing options...
.josh Posted September 20, 2008 Share Posted September 20, 2008 switch is the equivalent of select case and $_GET['variablenamehere'] is the equivalent of Request.QueryString('variablenamehere') Quote Link to comment https://forums.phpfreaks.com/topic/125075-query-string-use-i-have-read-posthelp-with-query-strings-in-html-but/#findComment-646390 Share on other sites More sharing options...
jimmyborofan Posted September 20, 2008 Author Share Posted September 20, 2008 That is fantastic! Thank you, I have really being tearing what little hair I have left out over this one! I may be able to begin to make some progress now! Thanks again Jimmy Quote Link to comment https://forums.phpfreaks.com/topic/125075-query-string-use-i-have-read-posthelp-with-query-strings-in-html-but/#findComment-646405 Share on other sites More sharing options...
.josh Posted September 20, 2008 Share Posted September 20, 2008 Oh also you don't need to declare vars in php like with the DIM in asp, unless you for instance want to declare a var as global so it can be used inside functions or whatever. Quote Link to comment https://forums.phpfreaks.com/topic/125075-query-string-use-i-have-read-posthelp-with-query-strings-in-html-but/#findComment-646407 Share on other sites More sharing options...
jimmyborofan Posted September 20, 2008 Author Share Posted September 20, 2008 Tops, That will save me a shed load of carpal tunnel when it comes to my exam! Quote Link to comment https://forums.phpfreaks.com/topic/125075-query-string-use-i-have-read-posthelp-with-query-strings-in-html-but/#findComment-646413 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.