hey guys, im sitting with a prob. everytime a member adds text with the & symbol, and displays the text he has added, an error occurs. what is the problem
Htmlspeacialchars
Collapse
X
-
i need someone to help me understand htmlspecialchars:
correct me if im wrong....
example
i add an address http://domain.com/ref=2&id=1 in a submit form (datatosend.php),
the address is then posted to (procdata.php) where the page looks like this
http://domain.com/ref=2&id=1 is posted to this form and string & is then replaced by & and then what happens at htmlspecialchars function. as far as i know after it has passed all functions it is then sent to the dbCode:else if($action=="addaddy") { $addy = mysql_real_escape_string($_POST["addy"]); $addy= str_replace('&', "&", $addy); { echo head($thm); echo pc(); $addy1 = htmlspecialchars($addy); $result = mysql_query("INSERT INTO address SET addy='".$addy1."'"); if($result) { echo "Address Added Successfully"; } else { echo "Database Error! "; echo "Please contact the administrator"; } } echo homelink($ses); echo pe(); echo foot(); }
Comment
Comment