Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

quotes into web address

Options
  • 12-09-2007 3:54pm
    #1
    Registered Users Posts: 91 ✭✭


    i have a php string that holds the value of a name. so it could possibly be something like o'connor etc. i know of the stripslashes($str) function which is fine and it gets rid of the value on the current page so that when you're doing searches in SQL databases it checks them correctly. however i need to put this same value into a link for previous and next pages. currently i have

    echo "<a href='employee.php?kw=".($name)."&dpt_id=".($dpt)."&sortby=".($sortby)."&page=".(page +1)."'class='text>Next>></a>";

    for the link to each next page


    but if you put in o'c as the value for the $name value then o\'c is now the value. Now the backslash is part of the $name and stops everything to the right of o\



    can #%39; help with this and how is it implemented?


Comments

  • Registered Users Posts: 706 ✭✭✭DJB


    replace ' with %27

    You need to do a URL Encode. Not sure of the exact command in PHP is but it's definately there.

    When you use urlencode, it replaces the ' with %27. There's loads of them for spaces, underscores, etc.

    See: http://php.net/urlencode

    Rgds,

    Dave


Advertisement