lyndacheetah
New Member
I Have created a form, which inserts data into a MySQL database. Here are the Form Fields, they are part of a \[code\]<form>\[/code\] but, i have not displayed the whole form here, just the fields which are creating a problem.\[code\]<tr> <td>Top 728x90 As</td><td><textarea name='topad'><?=$r['topad']?></textarea></td</tr><tr> <td>Sidebar 250x250 Ad</td><td><textarea name='sidebarad'><?=$r['sidebarad']?></textarea></td></tr>\[/code\]This part of code processes the input and inserts it into the database.\[code\]if(isset($_POST['submit'])) { $topad = $_POST['topad']; $sidebarad = $_POST['sidebarad']; $update = $connection->prepare("UPDATE site SET topad = '$topad' , sidebarad = '$sidebarad' WHERE id=1"); $update->execute(array());}\[/code\]The Problem with this code is, it is not accepting/processing the part of the data involving the \[code\]<a href="http://stackoverflow.com/questions/14053777/#">\[/code\] & \[code\]</a>\[/code\] code. This is not about escaping HTML characters, because all the other HTML tags like \[code\]<img>\[/code\],etc are showing as it is, which is what I want.So, whenever I insert and \[code\]<a>\[/code\] tag, it just disappears, neither it get's inserted in the database nor it shows up in the form after pressing submit button.UPDATE: When the link is inserted using Double Quotes, it gets accepted. If I use Single Quotes it is not processed. E.g. \[code\]<a href="http://stackoverflow.com/questions/14053777/someurl">\[/code\] will be accepted in the DB, while \[code\]<a href='http://stackoverflow.com/questions/14053777/someurl'>\[/code\] will not.Why does this error happen ?