Jump to content

Quotations in Form Data


GhosteX

Recommended Posts

So I'm using a form, kind of like the one I'm using right now, to insert data into a MySQL database, then display that data on the page, kind of like what will happen when I hit the "Post New Topic" button.Thing is, I get an error if that form data has quotations since the data itself is in quotations. When there is a quotation MySQL thinks that's where the query ends. If I switch to apostrophes, I get the same thing only with apostrophes. Is there a way to allow quotes in a form post without it causing errors? I can of course use entities or forward slashes but once the data is inserted, and I want to edit it, the data I get back has the actual quotations and apostrophes and I have to change it all again before re-submitting.The fact that I'm using quotes and apostrophes in this form right now mean I know this is possible. Any ideas? Thanks in advance.Here's a sample of the code.The query.$sql = "UPDATE $_POST[selecttable] SET priority=\"$_POST[editpriority]\", menu=\"$_POST[editmenu]\", content=\"$_POST[editcontent]\" WHERE menu = '$_POST[menulist]'"; The form.<textarea rows="20" cols="60" name="editcontent"> <?php echo $content; ?> </textarea> <p><input type="submit" name="Button" value="Edit"></p>

Link to comment
Share on other sites

that's part of the game. escaping them and then converting them back (or string replacing them). Shouldn't be too hard, that's the handy part about scripts, you just have write it do that and then it will do it from then on.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...