dirtysouth |
04-29-2008 07:56 AM |
Really Quick PHP Help REQ
I need to trim special characters out of a form because it's parsing the "'" (single quote) and fucking up a cart I'm building. Users that have something like "Joe's Mags" crashes the cart due to the single quote. Here's what I have:
PHP Code:
if(!empty($_POST['shipcompany']))
{
$shipcompany= trim($_POST['shipcompany']);
}
else
{
$shipcompany = '';
}
Been mucking around with this:
PHP Code:
$shipcompany = "'!£$%^&ss*()}{@:'#~/?><>/ 1 2 3 4 5 3/.,/:@/||\-=-__++-¬``1`sds";
$shipcompany = preg_replace('/[^a-z0-9]/', '', $shipcompany);
I just don't know how to mesh the code together. Thanks in advance as you guys always come through in a pinch and the client is pinching the fuck outta me ATM!
|