gengar003
08-24-2003, 01:23 AM
Eeh, anyway, I've got a variable, $data, and I want to put it into an <a href="blah bal&data="($data)">
etc, but $data has double/single quotes in it, and ">" and "<" signs... is there any way to get php to add slashes to any non-letter or single quote character?
(actual php code used)
// Okay, now the link to remove it.
$th_rong_named = "<a href=\"tacemon.php?action=give&tacemon=";
//oops! don't have that info yet; better query for the TAC?mon's $th_rite_name.
$th_rong_named .= $th_rite_name;
$th_rong_named .= "&subaction=take&username=";
//ALAS! More info to query for, this time, we need the actual USERNAME. (>.< gotta integrate this more...)
$usernaming_kwery = $DB_site->query_first("SELECT username FROM `user` WHERE userid=$counter");
$username = $usernaming_kwery[username];
$th_rong_named .= $username;
$th_rong_named .= "&catchname=";
$th_rong_named .= $th_rong_name;
$th_rong_named .= "&data=";
//<<<<<<<<<<<<<<<<<<<<<<<Problem start
//$th_rong_named .= $data;
//<<<<<<<<<<<<<<<<<<<<<<<Problem end.
$th_rong_named .= "\">";
$th_rong_named .= $th_rong_name;
$th_rong_named .= "</a>";
NOTE: I KNOW that the line with $data on it is commented out, that's because the script still runs w/out it, and it looks cleaner, but the functionality of that variable is missing...anyway.
etc, but $data has double/single quotes in it, and ">" and "<" signs... is there any way to get php to add slashes to any non-letter or single quote character?
(actual php code used)
// Okay, now the link to remove it.
$th_rong_named = "<a href=\"tacemon.php?action=give&tacemon=";
//oops! don't have that info yet; better query for the TAC?mon's $th_rite_name.
$th_rong_named .= $th_rite_name;
$th_rong_named .= "&subaction=take&username=";
//ALAS! More info to query for, this time, we need the actual USERNAME. (>.< gotta integrate this more...)
$usernaming_kwery = $DB_site->query_first("SELECT username FROM `user` WHERE userid=$counter");
$username = $usernaming_kwery[username];
$th_rong_named .= $username;
$th_rong_named .= "&catchname=";
$th_rong_named .= $th_rong_name;
$th_rong_named .= "&data=";
//<<<<<<<<<<<<<<<<<<<<<<<Problem start
//$th_rong_named .= $data;
//<<<<<<<<<<<<<<<<<<<<<<<Problem end.
$th_rong_named .= "\">";
$th_rong_named .= $th_rong_name;
$th_rong_named .= "</a>";
NOTE: I KNOW that the line with $data on it is commented out, that's because the script still runs w/out it, and it looks cleaner, but the functionality of that variable is missing...anyway.