petenaylor Posted June 5, 2011 Share Posted June 5, 2011 Hi all Is it possible to send this entire object via form to an SQL database? <object style="width:900px;height:636px" > <param name="movie" value="http://static.issuu.com/webembed/viewers/style1/v1/IssuuViewer.swf?mode=embed&layout=http%3A%2F%2Fskin.issuu.com%2Fv%2Flight%2Flayout.xml&showFlipBtn=true&documentId=110513182703-16892a8e7da64b33a15959c93e50a60b&docName=crafttonic_002&username=thecrafttonic&loadingInfoText=The%20Craft%20Tonic%20Issue%202&et=1305382654499&er=37" /> <param name="allowfullscreen" value="true"/><param name="menu" value="false"/><embed src="http://static.issuu.com/webembed/viewers/style1/v1/IssuuViewer.swf" type="application/x-shockwave-flash" allowfullscreen="true" menu="false" style="width:900px;height:636px" flashvars="mode=embed&layout=http%3A%2F%2Fskin.issuu.com%2Fv%2Flight%2Flayout.xml&showFlipBtn=true&documentId=110513182703-16892a8e7da64b33a15959c93e50a60b&docName=crafttonic_002&username=thecrafttonic&loadingInfoText=The%20Craft%20Tonic%20Issue%202&et=1305382654499&er=37" /> I need someone to be able to copy this code and send it to an SQL database and then echo it out on another page. Thanks for your help Pete Quote Link to comment https://forums.phpfreaks.com/topic/238487-pass-entire-object-through-php-form/ Share on other sites More sharing options...
wildteen88 Posted June 5, 2011 Share Posted June 5, 2011 If the user has to paste that code in then use a textarea Quote Link to comment https://forums.phpfreaks.com/topic/238487-pass-entire-object-through-php-form/#findComment-1225503 Share on other sites More sharing options...
Adam Posted June 5, 2011 Share Posted June 5, 2011 Are you referring to the mark-up, or the actual Flash object? Quote Link to comment https://forums.phpfreaks.com/topic/238487-pass-entire-object-through-php-form/#findComment-1225506 Share on other sites More sharing options...
petenaylor Posted June 5, 2011 Author Share Posted June 5, 2011 Hi there Yes I have a form already with a text area, the problem I have is that I can't pass it through the form because of the quote marks in the code. I need to send the whole <object> HTML. Thanks Pete Quote Link to comment https://forums.phpfreaks.com/topic/238487-pass-entire-object-through-php-form/#findComment-1225511 Share on other sites More sharing options...
wildteen88 Posted June 5, 2011 Share Posted June 5, 2011 Use htmlentities with the ENT_QUOTES flag when adding the code to the database. When you get it out of the database use html_entity_decode with the ENT_QUOTES flag (if you need that code to render the flash object on the page). Quote Link to comment https://forums.phpfreaks.com/topic/238487-pass-entire-object-through-php-form/#findComment-1225514 Share on other sites More sharing options...
Adam Posted June 5, 2011 Share Posted June 5, 2011 I wouldn't say encode it, just escape it with mysql_real_escape_string. The data would be about twice as large if you encode it, and you'll have to decode it. Quote Link to comment https://forums.phpfreaks.com/topic/238487-pass-entire-object-through-php-form/#findComment-1225535 Share on other sites More sharing options...
petenaylor Posted June 5, 2011 Author Share Posted June 5, 2011 Great! So could I build my string like this: $data=(mysql_real_escape_string($_POST['data'])); I have tried this but it doesn't seem to add it to the database? Quote Link to comment https://forums.phpfreaks.com/topic/238487-pass-entire-object-through-php-form/#findComment-1225537 Share on other sites More sharing options...
petenaylor Posted June 5, 2011 Author Share Posted June 5, 2011 Also the mySQL error I get is: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'style=\"width:900px;height:636px\" > Quote Link to comment https://forums.phpfreaks.com/topic/238487-pass-entire-object-through-php-form/#findComment-1225559 Share on other sites More sharing options...
Adam Posted June 5, 2011 Share Posted June 5, 2011 Can you show us the PHP making the query? Quote Link to comment https://forums.phpfreaks.com/topic/238487-pass-entire-object-through-php-form/#findComment-1225566 Share on other sites More sharing options...
petenaylor Posted June 5, 2011 Author Share Posted June 5, 2011 Hi there It's: $data = mysql_real_escape_string($_POST['data']); mysql_query(" UPDATE `issue_data` SET number='".$number."', month='".$month.", data = '".$data."'") or die(mysql_error()); Thanks! Quote Link to comment https://forums.phpfreaks.com/topic/238487-pass-entire-object-through-php-form/#findComment-1225568 Share on other sites More sharing options...
Adam Posted June 5, 2011 Share Posted June 5, 2011 You're missing a quote: month='".$month." Quote Link to comment https://forums.phpfreaks.com/topic/238487-pass-entire-object-through-php-form/#findComment-1225610 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.