hi,

i am looking at using a html5 script that helps draw on a canvas, how can i then save this to my database in a blob to then be shown again on the page at a later date?

the code is:

function RoSave(frm)
{    
    var strImageData = canvas.toDataURL();  

    $.ajax({
        url: "#", // place your Ajax URL here
        type: "post",
        data: "image_data="+encodeURIComponent(strImageData)+"&title="+frm.title.value
            +"&author="+frm.author.value,
        success: function(msg)
        {
           // on success output some message or redirect etc

what should i place in the url part? the php page whtat will save this?

and what shold my php page look like? i know how to do insert updates etc in php but not sure about this?

many thanks

url: "canvasSaveData.php",

canvasSaveData.php

<?php
//check logged in?
//include('app.php');
//if(loggedin){
//$_POST['image_data'] & $_POST['title'] & $_POST['author']
$Q = "INSERT into canvasdata (`fields`) VALUES ('$data')";
//run query
?>

not used the jquery version of ajax so not sure how to get the page responseText

hi sir kindly give the full step on how to save the canvas.
the table used in the database , also the fields.
how about the ajax url,
please!
tnx.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.