Have you tried prefixing your HTML code with:
"data:text/html, <!DOCTYPE HTML> "
Like this: <?php echo "data: text/html, <!DOCTYPE HTML> " . $AddToCart ; ?>? Where $AddToCart is the field with the code, "<form> ...</form>". I just tried it and got the same problem: the page displays the text, "data: text/html, <form action . . . </form>" and not the actual button. I can go for a much less elegant way by creating a file with the code and then using PHP include, but I would rather do it directly from the database.
Thanks for your help!
I was thinking more like:
"data:text/html, <!DOCTYPE HTML>" & $AddtoCart
where $AddtoCart is a variable with the code: <html>…your html code…</html>
but this may not be applicable to your use of PHP.
Is "data:text/html" HTML or PHP? If HTML, I would need a tag, and if PHP, it needs <?php. No?
Neither. That's why it may not be applicable to your needs.
When the web address of the FileMaker webviewer is set to data:text/html, <!DOCTYPE HTML>, the webviewer executes the appended text as HTML code.
Right. It is not working with CWP. Using the Include command works, though. Not pretty, but it works.
mbust (and jml) let's try to clarify:
1. the data URL is meant to be a SNIPPET of html AND if included inside another page definitely does NOT get the !DOCTYPE nor any of the head parts. Body is not used here either. You are already declaring the MIME-type
and further declarations are unnecessary.
You should not get a page (dynamic or otherwise) that was:
html head /head body html head /head body /body /html /body /html
If I was a browser I'd have a fit at this.
2. We do not know what is serving the page(s) from FMP fields other than "PHP". Is Joomla, Drupal, OSCommerce, WordPress, or other framework being used? frameworks may have "code" turned off to prevent users from entering "code" in form fields. Some allow the use of a module or plug-in to turn it back on and/or have a master switch for this when code is entered from an admin console.
3. "code" inside a field (FileMaker, MySQL or SQL) can get often get encoded by PHP configuration. Please research the use of these PHP functions to see if they help:
*these two lead to other functions that may be helpful
Beverly "web ma'am" Voth
Right. The double declaration would not help at all. From a quick look htmlspecialchars() with ent_html401 might do the trick. I'll look into that. For now, I've created an AppleScript to take the code for each of the related fields, automatically generate an HTML file (without any declarations), and upload it to the server. That makes the code available as a PHP include. Like I said, not very elegant, but now that it is done, it works very fast. And since button updates are not needed every day, it should work for now. Once I finish with other details currenly pressing on my time, I will return to this and clean it up.
Thank you very much!