Hello
I am storing company names in a variable. Im also urlencoding that variable.
When I urldecode the variable I gat a annoying \ character infront of the single quote.
HEre is the function inscription that in part register the company name in the database : $NomCie is the company name variable.
function inscription($Sexe,$Nom, $Prenom, $Titre, $Email, $SiteWeb, $Addresse,$Ville,$CodePostal,$NomCie,$Tel,$Exten)
{
include 'connection2.php'; // Connection.php est le fichier de connection à la BD
//$NomCie=addslashes($NomCie);
$NomCie=ereg_replace("'","'",$NomCie);
$NomCie=urlencode($NomCie);
$result= mysql_query ("INSERT INTO Compagnie(NomCie, Tel, Addresse, Ville, CodePostal,SiteWeb) VALUES ('$NomCie','$Tel', '$Addresse','$Ville','$CodePostal','$SiteWeb')");
$result= mysql_query ("INSERT INTO Contact(idContact,Sexe,Nom, Prenom, Titre, Compagnie_Tel,Compagnie_Nom , Email, Ext) VALUES ('','$Sexe','$Nom','$Prenom','$Titre','$Tel','$NomCie','$Email','$Exten')");
//$result= mysql_query ("INSERT INTO Evenement(Qui,Quand,Contact_idContact,TypeEvenement,Note,DateRappel,PrisRdv,DateRdv,Compagnie_NomCie,Compagnie_Tel ) VALUES ('$lutilisateur','$Quand','','$typeEvenement','$Note','$DateRappel','$Rdv','$dateRdv','$NomCie','$Tel')");
mysql_close();
//On remet les champs du rormulaire à vide
//$_POST["DateRappel"]="";
$_POST["Nom"]="";
$_POST["Prenom"]="";
$_POST["NomCie"]="";
$_POST["Tel"]="";
$_POST["Titre"]="";
$_POST["Email"]="";
$_POST["Addresse"]="";
$_POST["Ville"]="";
$_POST["CodePostal"]="";
$_POST["SiteWeb"]="";
$_POST["Exten"]="";
return $returnValue;
}//end of the function Inscription
Anyway so my prob is that I dunno what to do . Because if I do addslashes and than urlencode. Than on the page that echo the result if I do urldecode than stripslashes it doesnt work and show the name with a \ infront. Like this : o\'dares
What can I do ???????? I need to urlencode (I think) because some company name can have character like + or &
Check the code on paste bin : http://www.pastebin.com/100144
Here is the page that trys to echo the info : http://www.pastebin.com/100145
Help me !