I have been looking around loads for this. But nothing seems to be working. I have this input form for a forum. However, i am aware that you can input code from html to SQL. I was wondering how i can prevent this as obviously this would be devastating for someone to be able to use. Thanks for any help and suggestions.
<form id="form1" name="form1" method="post" action="add_topic.php">
<table>
<tr>
<td><strong>Create New Topic</strong></td>
</tr>
<tr>
<td><strong>Topic</strong></td>
<td><textarea maxlength="140" name="topic" type="text" id="topic" size="50" required/></textarea></td>
</tr>
<tr>
<td><strong>Detail</strong></td>
<td><textarea maxlength="655" name="detail" cols="50" rows="3" id="detail" required></textarea></td>
</tr>
<tr style="display: none;">
<td><strong>Name</strong></td>
<td><input name="name" type="text" id="name" size="50" value="<?php echo $_SESSION['username'];?>" readonly/></td>
</tr>
<tr>
<td> </td>
<td><input class="submit" type="submit" name="Submit" value="Submit" /> <input class="submit2" type="reset" style="float: right;" name="Submit2" value="Delete All" /></td>
</tr>
</table>
</td>
</form>
How can i implement something to this code to prevent code being submitted in my form that can affect my website. Thanks.