I am out of hope for this question to which the answer will finally complete my project.
I am using a signature plugin/API ( https://github.com/szimek/signature_pad ) as one of the input fields in a form in the first file form.php. When the form is submitted I am sending the data to a database and retrieve useful data. this useful data is seen in the second file success.php. I have successfully gotten the all data except the signature.
The signature is not an <input>
but a <canvas>
because of the plugins
when the form is submitted a javascript file sends the signature toDataURL a function from the documentation of signaturepad.js. Currently I have send it to a window.open new window. The url shows a data64 text which when converted is a image.
The problem is accessing this dataURL from success.php. When I can to this I can also send it to a database and send it within the automatic mail.
how do I get my signature to the second file as an image?
this is my code:
form.php
<form id="form">
<canvas id="signature"></canvas>
form.js
var signature = $("#signature");
var signaturePad = new SignaturePad(signature);
$("#form").submit(function(e) {
signaturePad.toDataURL(); )};
success.php (my idea how it should work)
<?php $image = $_POST['signaturePad']; ?>
<?php echo "<img src='"$image"'>";
success.php within SQL statements
$sql = "INSERT INTO $table ($field) VALUES ($image)";
I have also tried other options and API/plugins but I think this would be the best solution.