Advertisement
Help Keep Boards Alive. Support us by going ad free today. See here: https://subscriptions.boards.ie/.
If we do not hit our goal we will be forced to close the site.

Current status: https://keepboardsalive.com/

Annual subs are best for most impact. If you are still undecided on going Ad Free - you can also donate using the Paypal Donate option. All contribution helps. Thank you.
https://www.boards.ie/group/1878-subscribers-forum

Private Group for paid up members of Boards.ie. Join the club.

PHP Question

  • 12-06-2002 11:36AM
    #1
    Registered Users, Registered Users 2 Posts: 14,762 ✭✭✭✭


    I am a ASP programmer and need to use a php code to request something off the querystring. I know no PHP what so ever but need to use it as the server does not to my knowledge run ASP.

    The PHP code im looking for, in ASP is: <%=Request.QueryString("image")%>

    According to DreamweaverXP its: <?php echo HTTP_GET_VARS[image]; ?>.

    What is the PHP code to get image from the QueryString?


Comments

  • Banned (with Prison Access) Posts: 16,659 ✭✭✭✭dahamsta


    Hi Winters,

    According to DreamweaverXP its: <?php echo HTTP_GET_VARS[image]; ?>.

    It should be $HTTP_GET_VARS. In later versions of PHP, where register_globals is turned off, you can use the pseudo-global $_GET array: $_GET. (You don't really need the qoutes around the element, but it's good coding practise.)

    HTH,
    adam


  • Closed Accounts Posts: 6,601 ✭✭✭Kali


    doesnt' php automatically parse the query string anyway and turn them into variables?

    although its not the most secure way of doing it just accessing $image should work..

    unless i'm missing something :)


  • Banned (with Prison Access) Posts: 16,659 ✭✭✭✭dahamsta


    doesnt' php automatically parse the query string anyway and turn them into variables?

    It does indeed, but newer versions have this behaviour (register_globals) turned off by default.

    although its not the most secure way of doing it just accessing $image should work..

    It should, but it's better to avoid it. Course, it's just a matter of code cleanliness, but where would we be without standards? :)

    adam


  • Registered Users, Registered Users 2 Posts: 14,762 ✭✭✭✭Winters


    Thanks. Could never get it to work. Im guessing the problem is with IIS :rolleyes: . ASP is a lot easier :D


Advertisement