{"id":47113,"date":"2019-11-10T03:01:42","date_gmt":"2019-11-09T17:01:42","guid":{"rendered":"http:\/\/www.rjmprogramming.com.au\/ITblog\/?p=47113"},"modified":"2019-11-11T13:01:45","modified_gmt":"2019-11-11T03:01:45","slug":"pdf-slideshow-and-form-creation-url-contents-tutorial","status":"publish","type":"post","link":"https:\/\/www.rjmprogramming.com.au\/ITblog\/pdf-slideshow-and-form-creation-url-contents-tutorial\/","title":{"rendered":"PDF Slideshow and Form Creation URL Contents Tutorial"},"content":{"rendered":"<div style=\"width: 230px\" class=\"wp-caption alignnone\"><a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/PHP\/form_creator.php\"><img decoding=\"async\" style=\"border: 15px solid pink;\" alt=\"PDF Slideshow and Form Creation URL Contents Tutorial\" src=\"http:\/\/www.rjmprogramming.com.au\/PHP\/fpdf_url.jpg\" title=\"PDF Slideshow and Form Creation URL Contents Tutorial\"  style=\"float:left;\" \/><\/a><p class=\"wp-caption-text\">PDF Slideshow and Form Creation URL Contents Tutorial<\/p><\/div>\n<p>We need more tweaking regarding the canvas rendering implications of yesterday&#8217;s <a title='PDF Slideshow and Form Creation Poll Input Tutorial' href='#pdfsfcpit'>PDF Slideshow and Form Creation Poll Input Tutorial<\/a>, which we hope to get back to soon, but there is another matter of scope to attend to today.  It sounds big to put to you that that matter concerns a new &#8230;<\/p>\n<p><code><br \/>\nURL Contents<br \/>\n<\/code><\/p>\n<p> &#8230; button to place into the HTML textarea element the relevant contents of a user defined URL, doesn&#8217;t it?   But the fact is, with a serverside language like PHP in play, &#8220;the attempt&#8221; to make this happen is not that hard, given PHP&#8217;s &#8230;<\/p>\n<ul>\n<li><a target=_blank title='file_get_contents' href='http:\/\/us1.php.net\/file_get_contents'>file_get_contents<\/a> &#8230; filtered via &#8230;<\/li>\n<li>strip out non body tag webpage content &#8230; and &#8230;<\/li>\n<li>relative (URL) to absolute (URL) mapping (serverside) &#8230; as per &#8230;<br \/>\n&lt;?php<br \/>\n<code><br \/>\nfunction relative_to_absolute_php($inth) {<br \/>\n    global $udirname;<br \/>\n    $outth = $inth;<br \/>\n    $ideas = array(\" action='\", ' action=\"', \" Action='\", ' Action=\"', \" ACTION='\", ' ACTION=\"', \" action=\", \" Action=\", \" ACTION=\", \" href='\", ' href=\"', \" Href='\", ' Href=\"', \" HREF='\", ' HREF=\"', \" href=\", \" Href=\", \" HREF=\", \" src='\", ' src=\"', \" Src='\", ' Src=\"', \" SRC='\", ' SRC=\"', \" src=\", \" Src=\", \" SRC=\");<br \/>\n    if ($udirname != \"\") {<br \/>\n     for ($m=0; $m&lt;sizeof($ideas); $m++) {<br \/>\n      $huhs = explode($ideas[$m], $inth);<br \/>\n      if (sizeof($huhs) &gt; 1) {<br \/>\n        for ($ii=(sizeof($huhs) - 1); $ii&gt;=1; $ii--) {<br \/>\n          if (strtolower(str_replace(\"file\", \"http\", strtolower(substr($huhs[$ii], 0, 4)))) == \"http\") {<br \/>\n            $outth = $outth;<br \/>\n          } else if (substr($huhs[$ii], 0, 1) != \"\/\" && substr($huhs[$ii], 0, 1) != \"'\" && substr($huhs[$ii], 0, 1) != '\"') {<br \/>\n            $outth = str_replace(\"\/.\/\",\"\/\",str_replace($huhs[$ii], $udirname . $huhs[$ii], $outth));<br \/>\n          } else if (substr($huhs[$ii], 1, 1) != \"\/\" && substr($huhs[$ii], 0, 1) != \"'\" && substr($huhs[$ii], 0, 1) != '\"') {<br \/>\n            $outth = str_replace(\"\/.\/\",\"\/\",str_replace($huhs[$ii], substr($udirname, 0, (strlen($udirname) - 1)) . $huhs[$ii], $outth));<br \/>\n          }<br \/>\n        }<br \/>\n      }<br \/>\n     }<br \/>\n    }<br \/>\n    if (strpos($outth, \"&lt;\/body&gt;\") !== false && strpos($outth, \"&lt;body\") !== false) {<br \/>\n      return \"&lt;body\" . explode(\"&lt;body\", explode(\"&lt;\/body&gt;\", $outth)[0])[-1 + sizeof(explode(\"&lt;body\", explode(\"&lt;\/body&gt;\", str_replace(\"\/.\/\",\"\/\",$outth))[0]))] . \"&lt;\/body&gt;\";<br \/>\n    }<br \/>\n    return str_replace(\"\/.\/\",\"\/\",$outth);<br \/>\n}<br \/>\n<\/code><br \/>\n?&gt;<br \/>\n &#8230; called via one new non submit &#8220;URL Contents&#8221; button as per &#8230;<\/li>\n<li>\n<code><br \/>\n&lt;input onclick=\"urlit();\" style=\"background-color:lightblue;\" value=\"URL Contents\" type=button&gt;&lt;\/input&gt;<br \/>\n<\/code><br \/>\n &#8230; calling on the <i>onclick<\/i> Javascript (client) logic &#8230;<br \/>\n<code><br \/>\n      function urlit() {<br \/>\n       var urlis=prompt('Enter URL to showin textarea above', '');<br \/>\n       if (urlis == null) { urlis=''; }<br \/>\n       if (urlis != '') { location.href=document.URL.split('#')[0].split('?')[0] + '?url=' + encodeURIComponent(urlis); }<br \/>\n      }<br \/>\n<\/code><br \/>\n &#8230; and navigationally responded to, on recall, via &#8230;\n<\/li>\n<li>\n&lt;?php<br \/>\n<code><br \/>\nif (isset($_GET['url'])) {<br \/>\n  $udirname=explode(\"#\", explode(\"?\", str_replace('+',' ',urldecode($_GET['url'])))[0])[0];<br \/>\n  if (substr((\" \" . $udirname),-1) != \"\/\" && strpos(strtolower($udirname), \".php\") === false && strpos(strtolower($udirname), \".htm\") === false) {<br \/>\n     $udirname.=\"\/\";<br \/>\n  } else if (strpos(strtolower($udirname), \".php\") !== false || strpos(strtolower($udirname), \".htm\") !== false) {<br \/>\n     $udirname=str_replace(explode(\"\/\", $udirname)[-1 + sizeof(explode(\"\/\", $udirname))], \"\", $udirname);<br \/>\n  }<br \/>\n  $contis=relative_to_absolute_php(file_get_contents(urldecode($_GET['url'])));<br \/>\n}<br \/>\n<\/code><br \/>\n?&gt;\n<\/li>\n<\/ul>\n<p> &#8230; which is, in the whole scheme of (software) integration changes, not a hard one, as long as a serverside language (like PHP) is involved.<\/p>\n<p>Yet again, to see this, try <a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/PHP\/Geographicals\/diff.php?one=http:\/\/www.rjmprogramming.com.au\/PHP\/form_creator.php----------GETME\" title=\"form_creator.php\">the changed<\/a> <a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/PHP\/form_creator.php----------GETME\" title=\"form_creator.php\">form_creator.php<\/a>&#8216;s <a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/PHP\/form_creator.php\" title=\"Click picture\">live run<\/a> parts where PDF is rendered via Fpdf where the input data contains <i>input<\/i> element HTML.<\/p>\n<p><!--p>You can also see this play out at WordPress 4.1.1's <a target=_blank  href='\/\/www.rjmprogramming.com.au\/ITblog\/pdf-slideshow-and-form-creation-url-contents-tutorial\/'>PDF Slideshow and Form Creation URL Contents Tutorial<\/a>.<\/p-->\n<hr>\n<p id='pdfsfcpit'>Previous relevant <a target=_blank title='PDF Slideshow and Form Creation Poll Input Tutorial' href='\/\/www.rjmprogramming.com.au\/ITblog\/pdf-slideshow-and-form-creation-poll-input-tutorial\/'>PDF Slideshow and Form Creation Poll Input Tutorial<\/a> is shown below.<\/p>\n<div style=\"width: 230px\" class=\"wp-caption alignnone\"><a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/PHP\/form_creator.php\"><img decoding=\"async\" style=\"border: 15px solid pink;\" alt=\"PDF Slideshow and Form Creation Poll Input Tutorial\" src=\"http:\/\/www.rjmprogramming.com.au\/PHP\/fpdf_input.jpg\" title=\"PDF Slideshow and Form Creation Poll Input Tutorial\"  style=\"float:left;\"   \/><\/a><p class=\"wp-caption-text\">PDF Slideshow and Form Creation Poll Input Tutorial<\/p><\/div>\n<p>More rendering issues today, adding onto yesterday&#8217;s <a title='PDF Slideshow and Form Creation Poll Spreadsheet Tutorial' href='#pdfsfcpst'>PDF Slideshow and Form Creation Poll Spreadsheet Tutorial<\/a> progress.   We want to be able to render forms well in PDF eventually, and so we&#8217;re using the great start <a target=_blank title='Useful link' href='HTTP:\/\/www.fpdf.org\/en\/script\/script50.php' title='Rick van Buuren and Cl\u00e9ment Lavoillotte Fdf code, thanks'>Rick van Buuren and Cl\u00e9ment Lavoillotte<\/a>&#8216;s excellent HTML table rendering via <a target=_blank title='Fpdf PHP class' href='HTTP:\/\/www.fpdf.org\/'>Fpdf<\/a> code represents, and extending it.  Today, we start down the road to trying to render the HTML &#8230;<\/p>\n<p><code><br \/>\n<a target=_blank title='HTML input element information from w3schools' href='https:\/\/www.w3schools.com\/jsref\/dom_obj_url.asp'>input<\/a> element<br \/>\n<\/code><\/p>\n<p>.  So what&#8217;s the big deal here?  Well, to say you have a mini project to render the HTML input element is not that straightforward (it not being in the <a target=_blank title='Useful link' href='HTTP:\/\/www.fpdf.org\/en\/script\/script50.php' title='Rick van Buuren and Cl\u00e9ment Lavoillotte Fdf code, thanks'>Rick van Buuren and Cl\u00e9ment Lavoillotte<\/a> Fpdf open source code we found).   Consider the many and varied <i>type<\/i> attributes for an input element.   Consider the zillions of combinations of <i>outerHTML<\/i> manifestations of element attributes to cater for.  With this latter consideration, like with other types of HTML elements we try to render via Fpdf, it is a bigger ask than we can present here to cater for everything.  We&#8217;ll just try to deal with two attributes &#8230;<\/p>\n<ol>\n<li>type<\/li>\n<li>value<\/li>\n<\/ol>\n<p> &#8230; but even considering just these two HTML attributes, quite a bit of variation of procedure happens when coding it, a couple to exemplify being &#8230;<\/p>\n<ul>\n<li>input type=&#8221;color&#8221; <i>value<\/i> corresponds to a &#8220;Fpdf-speak&#8221; <i>bgcolor<\/i> attribute concern, not a content concern, that it mostly is for other <i>input<\/i> types &#8230;<\/li>\n<li>input type=&#8221;submit&#8221; and type=&#8221;button&#8221; content would be good presented as an overlay to a &#8220;Fpdf-speak&#8221; cell, whereas other types will want to look more like an underlay<\/li>\n<\/ul>\n<p>A job like this, that we are just starting down (the road of doing), and will tweak well into the future, helps you appreciate the &#8220;art&#8221; of web browser renderers (ie. programmers) out there in the &#8220;www&#8221; (woooooooooooooooprrrrrrrrllllllld wide web).<\/p>\n<p>Again, to see this, try <a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/PHP\/Geographicals\/diff.php?one=http:\/\/www.rjmprogramming.com.au\/PHP\/form_creator.php---------GETME\" title=\"form_creator.php\">the changed<\/a> <a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/PHP\/form_creator.php---------GETME\" title=\"form_creator.php\">form_creator.php<\/a>&#8216;s <a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/PHP\/form_creator.php\" title=\"Click picture\">live run<\/a> parts where PDF is rendered via Fpdf where the input data contains <i>input<\/i> element HTML.<\/p>\n<p><!--p>You can also see this play out at WordPress 4.1.1's <a target=_blank  href='\/\/www.rjmprogramming.com.au\/ITblog\/pdf-slideshow-and-form-creation-poll-input-tutorial\/'>PDF Slideshow and Form Creation Poll Input Tutorial<\/a>.<\/p-->\n<hr>\n<p id='pdfsfcpst'>Previous relevant <a target=_blank title='PDF Slideshow and Form Creation Poll Spreadsheet Tutorial' href='\/\/www.rjmprogramming.com.au\/ITblog\/pdf-slideshow-and-form-creation-poll-spreadsheet-tutorial\/'>PDF Slideshow and Form Creation Poll Spreadsheet Tutorial<\/a> is shown below.<\/p>\n<div style=\"width: 230px\" class=\"wp-caption alignnone\"><a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/PHP\/form_creator.php\"><img decoding=\"async\" style=\"border: 15px solid pink;\" alt=\"PDF Slideshow and Form Creation Poll Spreadsheet Tutorial\" src=\"http:\/\/www.rjmprogramming.com.au\/PHP\/fpdf_poll_csv_spreadsheet.jpg\" title=\"PDF Slideshow and Form Creation Poll Spreadsheet Tutorial\"  style=\"float:left;\"   \/><\/a><p class=\"wp-caption-text\">PDF Slideshow and Form Creation Poll Spreadsheet Tutorial<\/p><\/div>\n<p>Meanwhile, back at the polls, after yesterday&#8217;s <a title='PDF Slideshow and Form Creation Helper Canvas Tutorial' href='#pdfsfchct'>PDF Slideshow and Form Creation Helper Canvas Tutorial<\/a>, we wanted to add functionality to allow for sensible overview of captured Poll data.<\/p>\n<p>With this, though, to reinvent the wheel is a huge ask, and a bit of a silly ask, given the number of &#8220;out of the box&#8221; spreadsheet offerings out there.  Use PHP and you can hook up &#8230;<\/p>\n<ul>\n<li>web application produced (mimetype text\/csv) csv (comma separated values) data &#8230; via &#8230;<\/li>\n<li>(local) download &#8230; and onto, optionally &#8230;<\/li>\n<li>default spreadsheet application opened with this csv data<\/li>\n<\/ul>\n<p> &#8230; and once all this happens, a good spreadsheet application will offer you ways to compare and tabulate and show in a variety of chart forms, the contents of this &#8220;rows and columns&#8221; data as a whole or as subsets of the whole.<\/p>\n<p>How does PHP arrange it?  One new non-submit button calling on the Javascript (client) onclick event logic &#8230;<\/p>\n<p><code><br \/>\n      function collateit() {<br \/>\n         window.open(document.URL.split('?')[0].split('#')[0] + '?collate=' + Math.floor(Math.random() * 18765432), '_blank', 'top=80,left=80,width=500,height=500');<br \/>\n      }<br \/>\n<\/code><\/p>\n<p>How does PHP create the csv data?  One new &#8220;if&#8221; PHP code snippet as per &#8230;<\/p>\n<p>&lt;?php<br \/>\n<code><br \/>\nif (isset($_GET['collate'])) {<br \/>\n    $bits=explode('\/' . '\/ ?', $wasphpcode);<br \/>\n    $csvis=\"\";<br \/>\n    for ($ij=1; $ij&lt;sizeof($bits); $ij++) {<br \/>\n      $arec=explode(\"\\n\", $bits[$ij])[0];<br \/>\n      if (strpos($arec, \"&ipollid=\") !== false) {<br \/>\n        $plid=explode(\"&\", explode(\"&ipollid=\", $arec)[1])[0];<br \/>\n        $arec=str_replace(\"&ipollid=\" . $plid, \"\", $arec);<br \/>\n        if ($csvis == \"\") {<br \/>\n          $csvis='\"Poller Number\",\"Timestamp\",\"Favourite anything\",\"Favourite integer\",\"Favourite colour\",\"Favourite file\",\"Favourite email\",\"Favourite url\",\"Favourite date\",\"Favourite time\",\"Favourite month\"' . \"\\n\";<br \/>\n        }<br \/>\n        if (strpos($arec, \"&timestamp=\") !== false) {<br \/>\n          $ts=explode(\"&\", explode(\"&timestamp=\", $arec)[1])[0];<br \/>\n          \/\/ Initialising a DateTime<br \/>\n          date_default_timezone_set('GMT');<br \/>\n          \/\/$datetime = gmdate(\"M d Y H:i:s\", mktime(0, 0, 0, 1, 1, 1970)); \/\/new DateTime('2019-09-30');<br \/>\n          $xdatetime = new DateTime('1970-01-01 00:00:00');<br \/>\n          \/\/ DateInterval object is taken as the<br \/>\n          \/\/ parameter of the add() function<br \/>\n          \/\/ Here lots of seconds added<br \/>\n          $dis=(($ts - ($ts % (24 * 60 * 60))) \/ (24 * 60 * 60));<br \/>\n          $hrs=floor(($ts % (24 * 60 * 60)) \/ (60 * 60));<br \/>\n          $mins=floor(($ts % (60 * 60)) \/ 60);<br \/>\n          $secs=floor(($ts % 60));<br \/>\n<br \/> <br \/>\n          $xdatetime-&gt;add(new DateInterval('P' . $dis . 'D'));<br \/>\n          $xdatetime-&gt;add(new DateInterval('PT' . $hrs . 'H'));<br \/>\n          $xdatetime-&gt;add(new DateInterval('PT' . $mins . 'M'));<br \/>\n          $xdatetime-&gt;add(new DateInterval('PT' . $secs . 'S'));<br \/>\n<br \/> <br \/>\n          $arec=str_replace(\"&timestamp=\" . $ts, \"\", $arec);<br \/>\n          $brec='\"' . $plid . '\",\"' . $xdatetime-&gt;format('Y-m-d H:i:s') . \" GMT\" . '\",\"' . str_replace(\"+\",\" \",urldecode(explode(\"&\", explode(\"fa=\", $arec)[1])[0])) . '\",\"' . str_replace(\"+\",\" \",urldecode(explode(\"&\", explode(\"fn=\", $arec)[1])[0])) . '\",\"' . str_replace(\"+\",\" \",urldecode(explode(\"&\", explode(\"fc=\", $arec)[1])[0])) . '\",\"' . str_replace(\"+\",\" \",urldecode(explode(\"&\", explode(\"ff=\", $arec)[1])[0])) . '\",\"' . str_replace(\"+\",\" \",urldecode(explode(\"&\", explode(\"fe=\", $arec)[1])[0])) . '\",\"' . str_replace(\"+\",\" \",urldecode(explode(\"&\", explode(\"fu=\", $arec)[1])[0])) . '\",\"' . str_replace(\"+\",\" \",urldecode(explode(\"&\", explode(\"fd=\", $arec)[1])[0])) . '\",\"' . str_replace(\"+\",\" \",urldecode(explode(\"&\", explode(\"ft=\", $arec)[1])[0])) . '\",\"' . str_replace(\"+\",\" \",urldecode(explode(\"&\", explode(\"fm=\", $arec)[1])[0])) . '\"' . \"\\n\";<br \/>\n        } else {<br \/>\n          $brec='\"' . $plid . '\",\"\",\"' . str_replace(\"+\",\" \",urldecode(explode(\"&\", explode(\"fa=\", $arec)[1])[0])) . '\",\"' . str_replace(\"+\",\" \",urldecode(explode(\"&\", explode(\"fn=\", $arec)[1])[0])) . '\",\"' . str_replace(\"+\",\" \",urldecode(explode(\"&\", explode(\"fc=\", $arec)[1])[0])) . '\",\"' . str_replace(\"+\",\" \",urldecode(explode(\"&\", explode(\"ff=\", $arec)[1])[0])) . '\",\"' . str_replace(\"+\",\" \",urldecode(explode(\"&\", explode(\"fe=\", $arec)[1])[0])) . '\",\"' . str_replace(\"+\",\" \",urldecode(explode(\"&\", explode(\"fu=\", $arec)[1])[0])) . '\",\"' . str_replace(\"+\",\" \",urldecode(explode(\"&\", explode(\"fd=\", $arec)[1])[0])) . '\",\"' . str_replace(\"+\",\" \",urldecode(explode(\"&\", explode(\"ft=\", $arec)[1])[0])) . '\",\"' . str_replace(\"+\",\" \",urldecode(explode(\"&\", explode(\"fm=\", $arec)[1])[0])) . '\"' . \"\\n\";<br \/>\n        }<br \/>\n        $csvis.=$brec;<br \/>\n      }<br \/>\n    }<br \/>\n    if ($csvis != \"\") {<br \/>\n      header('Content-type: text\/csv');<br \/>\n      header('Content-disposition: attachment;filename=form_creator.csv');<br \/>\n      echo $csvis;<br \/>\n      exit;<br \/>\n    }<br \/>\n}<br \/>\n<\/code><br \/>\n?&gt;<\/p>\n<p>To see this, try <a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/PHP\/Geographicals\/diff.php?one=http:\/\/www.rjmprogramming.com.au\/PHP\/form_creator.php--------GETME\" title=\"form_creator.php\">the changed<\/a> <a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/PHP\/form_creator.php--------GETME\" title=\"form_creator.php\">form_creator.php<\/a>&#8216;s <a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/PHP\/form_creator.php\" title=\"Click picture\">live run<\/a>.<\/p>\n<p><!--p>You can also see this play out at WordPress 4.1.1's <a target=_blank  href='\/\/www.rjmprogramming.com.au\/ITblog\/pdf-slideshow-and-form-creation-poll-spreadsheet-tutorial\/'>PDF Slideshow and Form Creation Poll Spreadsheet Tutorial<\/a>.<\/p-->\n<hr>\n<p id='pdfsfchct'>Previous relevant <a target=_blank title='PDF Slideshow and Form Creation Helper Canvas Tutorial' href='\/\/www.rjmprogramming.com.au\/ITblog\/pdf-slideshow-and-form-creation-helper-canvas-tutorial\/'>PDF Slideshow and Form Creation Helper Canvas Tutorial<\/a> is shown below.<\/p>\n<div style=\"width: 230px\" class=\"wp-caption alignnone\"><a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/PHP\/form_creator.php\"><img decoding=\"async\" style=\"border: 15px solid pink;\" alt=\"PDF Slideshow and Form Creation Helper Canvas Tutorial\" src=\"http:\/\/www.rjmprogramming.com.au\/PHP\/fpdf_and_canvas.jpg\" title=\"PDF Slideshow and Form Creation Helper Canvas Tutorial\"  style=\"float:left;\"   \/><\/a><p class=\"wp-caption-text\">PDF Slideshow and Form Creation Helper Canvas Tutorial<\/p><\/div>\n<p>Today we venture back to other rendering thoughts regarding our <a title='PDF Slideshow and Poll Referrer Integration Tutorial' href='#pdfsprit'>PDF Slideshow and Poll Referrer Integration Tutorial<\/a> blog post thread&#8217;s existant use of &#8230;<\/p>\n<ul>\n<li>PDF rendering &#8230;in conjunction to &#8230;<\/li>\n<li>HTML rendering (of input HTML code) &#8230; and today we add &#8230;<\/li>\n<li>Canvas rendering &#8230; onto to Image rendering (for many web browsers)<\/li>\n<\/ul>\n<p> &#8230; as that graphical rendering choice.  Graphical (rendering) choices open you up to HTML img elements or background elements,and with many, onto animation possibilities.  No surprise, really, to us, as we often choose between PDF or an image or a set of images or animated GIF or video as the source data for our blog presentation ideas.<\/p>\n<p>This project keeps going into different areas and in different directions because the possibilities are numerous, but please do not despair nor be bewildered.  It&#8217;s the possibilities that count, not the look.  The look of things can be nuanced near the end, as required.  Components can be pared down and\/or simplified, but we have decided this is all for later.  We still have mode conceptual ideas to explore with all this work you can try with  <a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/PHP\/Geographicals\/diff.php?one=http:\/\/www.rjmprogramming.com.au\/PHP\/form_creator.php-------GETME\" title=\"form_creator.php\">the changed<\/a> <a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/PHP\/form_creator.php-------GETME\" title=\"form_creator.php\">form_creator.php<\/a>&#8216;s <a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/PHP\/form_creator.php\" title=\"Click picture\">live run<\/a>.<\/p>\n<p>How, in that code above, was Canvas rendering achieved, in broad brush terms?<\/p>\n<ol>\n<li>use of multiple form submit buttons &#8230;<br \/>\n<code><br \/>\n  if (isset($_POST['both']) || isset($_GET['both'])) {<br \/>\n  $canvh=\"&lt;html&gt;&lt;head&gt;&lt;scr\" . \"ipt type='text\/javascript'&gt; var elem=null,context=null,x=[],y=[],w=[],h=[],aimg=[],iimg=0; \" . $sleepcode . \" function di(iois) {  if (iois.src != '') { context.drawImage(ielem,x[iimg],y[iimg],w[iimg],h[iimg]); iimg++; if (aimg.length &gt; iimg) { iois.src=aimg[iimg] + '?xx=' + iimg; }  }  } function docanvas() { elem=document.getElementById('canvas'); ielem=document.getElementById('him'); context=elem.getContext('2d'); context.font='8px Arial';   } &lt;\/scr\" . \"ipt&gt;&lt;\/head&gt;&lt;body onload=\\\"  window.open('form_creator.pdf','_blank','left=50,top=50,width=695,height=942'); docanvas(); \\\"&gt;&lt;canvas style='border:1px solid red;width:595px;width:842px;' width=\" . (595 \/ 2.54) . \" height=\" . (842 \/ 2.54) . \" id=canvas&gt;&lt;\/canvas&gt;&lt;br&gt;&lt;img onload=di(this); id=him style=display:none; src=&gt;&lt;\/img&gt;&lt;\/body&gt;&lt;\/html&gt;\";<br \/>\n  for ($jj=0; $jj&lt;sizeof($pdf-&gt;canvascmds); $jj++) {<br \/>\n    $canvh=str_replace(\"} &lt;\",\" \" . $pdf-&gt;canvascmds[$jj] . \" \\n} &lt;\", $canvh);<br \/>\n  }<br \/>\n  $pdfcont=$pdf-&gt;Output('form_creator.pdf','F');<br \/>\n  echo $canvh;<br \/>\n  } else if (isset($_POST['justc']) || isset($_GET['justc'])) {<br \/>\n  $canvh=\"&lt;html&gt;&lt;head&gt;&lt;scr\" . \"ipt type='text\/javascript'&gt; var elem=null,context=null,x=[],y=[],w=[],h=[],aimg=[],iimg=0; \" . $sleepcode . \" function di(iois) {  if (iois.src != '') { context.drawImage(ielem,x[iimg],y[iimg],w[iimg],h[iimg]); iimg++; if (aimg.length &gt; iimg) { iois.src=aimg[iimg] + '?xx=' + iimg; }  }  } function docanvas() { elem=document.getElementById('canvas'); ielem=document.getElementById('him'); context=elem.getContext('2d'); context.font='8px Arial';   } &lt;\/scr\" . \"ipt&gt;&lt;\/head&gt;&lt;body onload=\\\"  docanvas(); \\\"&gt;&lt;canvas style='border:1px solid red;width:595px;width:842px;' width=\" . (595 \/ 2.54) . \" height=\" . (842 \/ 2.54) . \" id=canvas&gt;&lt;\/canvas&gt;&lt;br&gt;&lt;img onload=di(this); id=him style=display:none; src=&gt;&lt;\/img&gt;&lt;\/body&gt;&lt;\/html&gt;\";<br \/>\n  for ($jj=0; $jj&lt;sizeof($pdf-&gt;canvascmds); $jj++) {<br \/>\n    $canvh=str_replace(\"} &lt;\",\" \" . $pdf-&gt;canvascmds[$jj] . \" \\n} &lt;\", $canvh);<br \/>\n  }<br \/>\n  echo $canvh;<br \/>\n  } else {<br \/>\n  header('Content-type: application\/pdf');<br \/>\n  $pdf-&gt;Output();<br \/>\n  }<br \/>\n<\/code><br \/>\n &#8230; remember <a target=_blank title='HTML Form Multiple Submit Buttons Primer Tutorial' href='https:\/\/www.rjmprogramming.com.au\/ITblog\/html-form-multiple-submit-buttons-primer-tutorial\/'>HTML Form Multiple Submit Buttons Primer Tutorial<\/a>?<\/li>\n<li>intersperse the brilliance of <a target=_blank title='Useful link' href='HTTP:\/\/www.fpdf.org\/en\/script\/script50.php' title='Rick van Buuren and Cl\u00e9ment Lavoillotte Fdf code, thanks'>Rick van Buuren and Cl\u00e9ment Lavoillotte<\/a>&#8216;s excellent HTML table rendering via <a target=_blank title='Fpdf PHP class' href='HTTP:\/\/www.fpdf.org\/'>Fpdf<\/a> code with HTML5 <a target=_blank title='HTML Canvas element information from w3schools' href='http:\/\/www.w3schools.com\/tags\/ref_canvas.asp'>canvas<\/a> code (for that alternative rendering) <font size=1>&#8230; proving again, it is a lot of a battle, especially with event driven programming, to know when and\/or where to intervene, for most effect<\/font><\/li>\n<\/ol>\n<p>That interspersing is collected into Javascript command arrays (that $pdf-&gt;canvascmds above), which help piece together HTML for a whole new webpage (with canvas) HTML codeset.<\/p>\n<p>You can also see this play out at WordPress 4.1.1&#8217;s <a target=_blank  href='\/\/www.rjmprogramming.com.au\/ITblog\/pdf-slideshow-and-form-creation-helper-canvas-tutorial\/'>PDF Slideshow and Form Creation Helper Canvas Tutorial<\/a>.<\/p>\n<hr>\n<p id='pdfsprit'>Previous relevant <a target=_blank title='PDF Slideshow and Poll Referrer Integration Tutorial' href='\/\/www.rjmprogramming.com.au\/ITblog\/pdf-slideshow-and-poll-referrer-integration-tutorial\/'>PDF Slideshow and Poll Referrer Integration Tutorial<\/a> is shown below.<\/p>\n<div style=\"width: 230px\" class=\"wp-caption alignnone\"><a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/PHP\/form_creator.php\"><img decoding=\"async\" style=\"border: 15px solid pink;\" alt=\"PDF Slideshow and Poll Referrer Integration Tutorial\" src=\"http:\/\/www.rjmprogramming.com.au\/HTMLCSS\/referrer_integration_2.jpg\" title=\"PDF Slideshow and Poll Referrer Integration Tutorial\"  style=\"float:left;\"   \/><\/a><p class=\"wp-caption-text\">PDF Slideshow and Poll Referrer Integration Tutorial<\/p><\/div>\n<p>A data storage means for our latest Online Email Polling web application functionality was sorted out with yesterday&#8217;s <a title='PDF Slideshow and Poll Form Creation Storage Tutorial' href='#pdfspfcst'>PDF Slideshow and Poll Form Creation Storage Tutorial<\/a> and today we undertake &#8230;<\/p>\n<ul>\n<li>software integration of an initial email (inline HTML) execution with a means by which &#8230;<\/li>\n<li>continued user (via their email address) polling possibilities (and reporting) via online web browser access usage<\/li>\n<\/ul>\n<p> &#8230; that &#8220;continued user (via their email address) polling possibilities&#8221; courtesy of <a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/PHP\/Geographicals\/diff.php?one=http:\/\/www.rjmprogramming.com.au\/HTMLCSS\/oninvalid.html--GETME\" title=\"oninvalid.html\">a changed and integrated<\/a> <a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/HTMLCSS\/oninvalid.html--GETME\" title=\"oninvalid.html\">oninvalid.html<\/a> (with <a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/PHP\/Geographicals\/diff.php?one=http:\/\/www.rjmprogramming.com.au\/PHP\/form_creator.php------GETME\" title=\"form_creator.php\">the changed<\/a> <a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/PHP\/form_creator.php------GETME\" title=\"form_creator.php\">form_creator.php<\/a>&#8216;s <a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/PHP\/form_creator.php\" title=\"Click picture\">live run<\/a>).<\/p>\n<p>As you would surmise, to (software) integrate you need messaging conduits that let one software component let other integrated software components know something about their environment via these &#8220;conduit ideas&#8221;.  Our &#8220;conduit idea&#8221; today is &#8230;<\/p>\n<table>\n<tr>\n<th>Javascript (client)<\/th>\n<th>PHP (server)<\/th>\n<\/tr>\n<tr>\n<td>document.referrer<\/td>\n<td>$_SERVER[&#8216;HTTP_REFERER&#8217;]<\/td>\n<\/tr>\n<\/table>\n<p> &#8230; and it is with today&#8217;s &#8220;Javascript (client)&#8221; aspects (but remember Inline Email HTML disallows Javascript, and hence any of that <i>oninvalid<\/i> event logic available back at web browser incarnations) of the <a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/HTMLCSS\/oninvalid.html--GETME\" title=\"oninvalid.html\">oninvalid.html<\/a> work where we <b>add changes<\/b> to its scripting content as per &#8230;<\/p>\n<p><code><br \/>\n&lt;html&gt;<br \/>\n&lt;head&gt;<br \/>\n&lt;script type='text\/javascript'&gt;<br \/>\n  \/\/ other client Javascript logic here<br \/>\n<br \/> <br \/>\n  <b>function getref() {<br \/>\n    for (var ii=0; ii&lt;evalas.length; ii++) {<br \/>\n      eval(evalas[ii]);<br \/>\n    }<br \/>\n    var youremail='';<br \/>\n    if (('' + document.referrer).indexOf('creator.php') != -1) {<br \/>\n      if (('' + document.referrer).indexOf('?pollerquery=') != -1) {<br \/>\n        youremail=\" for Your Email [&lt;a title='Email to yourself via default email client application' href='mailto:\" + decodeURIComponent(('' + document.referrer).split('?pollerquery=')[1].split('&')[0]) + \"'&gt;\" + decodeURIComponent(('' + document.referrer).split('?pollerquery=')[1].split('&')[0]) + '&lt;\/a&gt;] ';<br \/>\n      }<br \/>\n      document.getElementById('myh1').innerHTML='Favourites Polling';<br \/>\n      document.getElementById('ibut').value='Poll Me';<br \/>\n      document.getElementById('myform').action=('' + document.referrer).split('?')[0].split('#')[0];<br \/>\n      if (document.URL.indexOf('timestamp=') != -1) {<br \/>\n      document.getElementById('dref').innerHTML=location.search.split('timestamp=')[1] ? '&lt;a target=_blank title=\"RJM Programming Favourites Polling\" href=\"' + document.getElementById('myform').action + '\"&gt;Favourites Polling&lt;\/a&gt;' + youremail + ' on ' + todatetime(location.search.split('timestamp=')[1].split('&')[0]) + ' ... &lt;br&gt;&lt;br&gt;' : '';<br \/>\n      if (evalas.length &gt; 0) {<br \/>\n      document.getElementById('ibut').value='Poll Me Again';<br \/>\n      }<br \/>\n      document.getElementById('dref').style.backgroundColor='yellow';<br \/>\n      document.getElementById('dref').style.border='5px solid pink';<br \/>\n      document.getElementById('dref').style.margin='5px 5px 5px 5px';<br \/>\n      }<br \/>\n    }<br \/>\n  }<\/b><br \/>\n<br \/>\n  setTimeout(dorep, 2000);<br \/>\n&lt;\/script&gt;<br \/>\n&lt;\/head&gt;<br \/>\n&lt;body<b> onload='getref();'<\/b>&gt;<br \/>\n \/\/ body HTML goes here<br \/>\n&lt;\/body&gt;<br \/>\n&lt;\/html&gt;<br \/>\n<\/code><\/p>\n<p> &#8230; the (software) integration via document.referrer (knowledge) turning <a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/HTMLCSS\/oninvalid.html--GETME\" title=\"oninvalid.html\">oninvalid.html<\/a> into a dual purpose web application (component), able to &#8220;talk and integrate or collaborate&#8221; with the supervisory <a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/PHP\/form_creator.php------GETME\" title=\"form_creator.php\">form_creator.php<\/a> &#8220;Online Email Polling&#8221; capable web application.<\/p>\n<p>The other aspect to &#8220;conduit talk&#8221; is how the user meets this software capability.  The user clicks the Polling button and adds a &#8220;?&#8221; to their email address to have the web application quiz itself as to whether that email address has ever been polled before, and this (software) integration gets called into play.<\/p>\n<table style='width:100%;'>\n<tr>\n<td><img src='http:\/\/www.rjmprogramming.com.au\/HTMLCSS\/referrer_integration_1.jpg'><\/img><\/td>\n<\/tr>\n<tr>\n<td><img src='http:\/\/www.rjmprogramming.com.au\/HTMLCSS\/referrer_integration_2.jpg'><\/img><\/td>\n<\/tr>\n<\/table>\n<p><!--p>You can also see this play out at WordPress 4.1.1's <a target=_blank  href='\/\/www.rjmprogramming.com.au\/ITblog\/pdf-slideshow-and-poll-referrer-integration-tutorial\/'>PDF Slideshow and Poll Referrer Integration Tutorial<\/a>.<\/p-->\n<hr>\n<p id='pdfspfcst'>Previous relevant <a target=_blank title='PDF Slideshow and Poll Form Creation Storage Tutorial' href='\/\/www.rjmprogramming.com.au\/ITblog\/pdf-slideshow-and-poll-form-creation-storage-tutorial\/'>PDF Slideshow and Poll Form Creation Storage Tutorial<\/a> is shown below.<\/p>\n<div style=\"width: 230px\" class=\"wp-caption alignnone\"><a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/PHP\/form_creator.php\"><img decoding=\"async\" style=\"border: 15px solid pink;\" alt=\"PDF Slideshow and Poll Form Creation Storage Tutorial\" src=\"http:\/\/www.rjmprogramming.com.au\/PHP\/favourites_polling_later.jpg\" title=\"PDF Slideshow and Poll Form Creation Storage Tutorial\"  style=\"float:left;\"   \/><\/a><p class=\"wp-caption-text\">PDF Slideshow and Poll Form Creation Storage Tutorial<\/p><\/div>\n<p>The means by which we can approach &#8220;Online Email Polling&#8221; was achieved with yesterday&#8217;s <a title='PDF Slideshow and Poll Form Creation Inline Email Tutorial' href='#pdfspfciet'>PDF Slideshow and Poll Form Creation Inline Email Tutorial<\/a>, but it stopped short of being accountable.  It was only of relevance to the user executing the web application in that incarnation.<\/p>\n<p>But what about storing the findings data somewhere for &#8230;<\/p>\n<ul>\n<li>recall (to the user who owns the Favourites Data) &#8230; and &#8230; further down the track &#8230;<\/li>\n<li>collate several user  sets of data into a statistical report of some kind<\/li>\n<\/ul>\n<p>?  Well, we start down that road today?  Do we use a database to do this?   Not exactly.  Do we use cookies or storage of that ilk?   Not exactly?  Well, what then?   We use the PHP itself to store user findings.  We have this as a choice because there is an element of data hiding to the use of PHP as the basis of your web application, and we&#8217;re making use of that fact today.<\/p>\n<table style='width:100%;'>\n<tr>\n<th>Was (before an rmetcalfe15@gmail.com polling) &#8230;<\/th>\n<\/tr>\n<tr>\n<td><img src='http:\/\/www.rjmprogramming.com.au\/PHP\/favourites_polling.jpg'><\/img><\/td>\n<\/tr>\n<tr>\n<th>Then (after an rmetcalfe15@gmail.com polling) &#8230;<\/th>\n<\/tr>\n<tr>\n<td><img src='http:\/\/www.rjmprogramming.com.au\/PHP\/favourites_polling_later.jpg'><\/img><\/td>\n<\/tr>\n<\/table>\n<p>And so yet again, we have <a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/PHP\/form_creator.php-----GETME\" title=\"form_creator.php\">form_creator.php<\/a>&#8216;s <a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/PHP\/form_creator.php\" title=\"Click picture\">live run<\/a> for you to try some more accountable Poll Email (Inline) HTML ideas.<\/p>\n<p><!--p>You can also see this play out at WordPress 4.1.1's <a target=_blank  href='\/\/www.rjmprogramming.com.au\/ITblog\/pdf-slideshow-and-poll-form-creation-storage-tutorial\/'>PDF Slideshow and Poll Form Creation Storage Tutorial<\/a>.<\/p-->\n<hr>\n<p id='pdfspfciet'>Previous relevant <a target=_blank title='PDF Slideshow and Poll Form Creation Inline Email Tutorial' href='\/\/www.rjmprogramming.com.au\/ITblog\/pdf-slideshow-and-poll-form-creation-inline-email-tutorial\/'>PDF Slideshow and Poll Form Creation Inline Email Tutorial<\/a> is shown below.<\/p>\n<div style=\"width: 230px\" class=\"wp-caption alignnone\"><a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/PHP\/form_creator.php\"><img decoding=\"async\" style=\"border: 15px solid pink;\" alt=\"PDF Slideshow and Poll Form Creation Inline Email Tutorial\" src=\"http:\/\/www.rjmprogramming.com.au\/PHP\/poll_good.jpg\" title=\"PDF Slideshow and Poll Form Creation Inline Email Tutorial\"  style=\"float:left;\"   \/><\/a><p class=\"wp-caption-text\">PDF Slideshow and Poll Form Creation Inline Email Tutorial<\/p><\/div>\n<p>Another functionality dovetailing with the recent <a title='PDF Slideshow and Form Creation Helper Inline Email Tutorial' href='#pdfsfchiet'>PDF Slideshow and Form Creation Helper Inline Email Tutorial<\/a>&#8216;s use of Email Inline HTML (mimetype text\/html), we figure, is &#8230;<\/p>\n<p><code><br \/>\nOnline Polling via Email<br \/>\n<\/code><\/p>\n<p> &#8230; being that &#8220;one step easier than downloading&#8221; method to try to garner someone&#8217;s opinion online.  Looks wise, it just involves one more button to our form, and behind the scenes, one hidden HTML textarea element.  Leave this too open-ended, and you&#8217;ll end up with a lot of spam answers, alas.   So we turned our mind to deconstructing HTML from the recent <a target=_blank href='https:\/\/www.rjmprogramming.com.au\/ITblog\/html-oninvalid-event-form-validation-primer-tutorial\/' title='HTML Oninvalid Event Form Validation Primer Tutorial'>HTML Oninvalid Event Form Validation Primer Tutorial<\/a>, paring it back and rearranging code that was in the head section to be in the body section.   Not too hard, really.<\/p>\n<p>What we did learn, doing this, was how to push the Exim Mail Server functionality up at the rjmprogramming.com.au web server deliver an individual email message in the queue ahead of the 30 build up Exim waits for, in that queue, before delivering emails, in the normal case of events.  You can see this &#8230;<\/p>\n<p><code><br \/>\n# cd \/var\/log<br \/>\n# # Do the work in the browser to set up and send the email ... then ...<br \/>\n# tail exim_mainlog | grep 'rmetcalfe15@gmail.com'<br \/>\n# # copy the last record's third word (after two timestamp related words) into {buffer}<br \/>\n# exim -M [paste {buffer} here]<br \/>\n#<br \/>\n<\/code><\/p>\n<p> &#8230; play out at the bottom of today&#8217;s <a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/PHP\/poll_good.jpg\">tutorial picture<\/a>.<\/p>\n<p>So yet again, we have <a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/PHP\/form_creator.php----GETME\" title=\"form_creator.php\">form_creator.php<\/a>&#8216;s <a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/PHP\/form_creator.php\" title=\"Click picture\">live run<\/a> for you to try some Poll Email (Inline) HTML ideas.<\/p>\n<p><!--p>You can also see this play out at WordPress 4.1.1's <a target=_blank  href='\/\/www.rjmprogramming.com.au\/ITblog\/pdf-slideshow-and-poll-form-creation-inline-email-tutorial\/'>PDF Slideshow and Poll Form Creation Inline Email Tutorial<\/a>.<\/p-->\n<hr>\n<p id='pdfsfchiet'>Previous relevant <a target=_blank title='PDF Slideshow and Form Creation Helper Inline Email Tutorial' href='\/\/www.rjmprogramming.com.au\/ITblog\/pdf-slideshow-and-form-creation-helper-inline-email-tutorial\/'>PDF Slideshow and Form Creation Helper Inline Email Tutorial<\/a> is shown below.<\/p>\n<div style=\"width: 230px\" class=\"wp-caption alignnone\"><a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/PHP\/form_creator.php\"><img decoding=\"async\" style=\"border: 15px solid pink;\" alt=\"PDF Slideshow and Form Creation Helper Inline Email Tutorial\" src=\"http:\/\/www.rjmprogramming.com.au\/PHP\/form_creator_emailinline.jpg\" title=\"PDF Slideshow and Form Creation Helper Inline Email Tutorial\"  style=\"float:left;\"   \/><\/a><p class=\"wp-caption-text\">PDF Slideshow and Form Creation Helper Inline Email Tutorial<\/p><\/div>\n<p>Up to now, here at RJM Programming with this blog, we&#8217;ve resisted talking much about &#8230;<\/p>\n<ul>\n<li>emails containing HTML Inline (ie. those with a mime type of text\/html) &#8230; in favour of (talking more about) &#8230;<\/li>\n<li>emails containing HTML Attachments (ie. have a mime type of text\/plain with the body of the email and mime type application\/octet for attachments)<\/li>\n<\/ul>\n<p> &#8230; and yet, the former has the advantage that you can get an online task done without a download operation, necessarily.  So why the bias to more online work <font size=1>(does not compute)<\/font>?  Well, it is to do with the restrictions the email client applications put on the types of data accepted with HTML Inline text\/html data, that is not as stringent as that imposed on HTML Attachments that would have to be downloaded onto your local system to have any impact and so is one step removed from security issues (but still a consideration, we hope you&#8217;d agree).  It depends a lot on <a target=_blank title='HTML Emailinformation fromWikipedia, thanks' href='https:\/\/en.wikipedia.org\/wiki\/HTML_email'>the email client<\/a> involved, but suspects to not accepting (or stripping) your HTML data are &#8230;<\/p>\n<ul>\n<li>no Javascript in document.head nor document.body (with onload event logic and other inline event logics, even)<\/li>\n<li>sometimes no document.head will be accepted (eg. <a target=_blank title='Gmail' href='https:\/\/gmail.com'>Gmail<\/a>)<\/li>\n<\/ul>\n<p> &#8230; and this makes what is useful as Email (Inline) HTML as a very small subset of HTML(\/CSS\/Javascript) functionality <font size=1>(pretty much just HTML design and inline CSS styling)<\/font>.  Nevertheless, for today&#8217;s work, after the leads of yesterday&#8217;s <a title='PDF Slideshow and Form Creation Helper Preview Tutorial' href='#pdfsfchpt'>PDF Slideshow and Form Creation Helper Preview Tutorial<\/a>, especially its revisit to mapping relative URLs to absolute URLs (ie. ones starting with &#8220;http:&#8221; or &#8220;https:&#8221;) &#8230;<\/p>\n<p><code><br \/>\n      var url=document.URL.split('#')[0].split('?')[0];<br \/>\n<br \/>\n function relative_to_absolute(inth) {<br \/>\n    var huhs, posthuhs, ii, m, delimis=\\\" \\\";<br \/>\n    var uubits=url.split(\\\"?\\\");<br \/>\n<br \/>\n    if (url == \\\"\\\") return inth;<br \/>\n<br \/>\n    if (uubits[0].indexOf(\\\"\/\\\") != -1) {<br \/>\n      var uuubits=uubits[0].split(\\\"\/\\\");<br \/>\n      if (uuubits[eval(uuubits.length - 1)] != \\\"\\\") {<br \/>\n        if (uuubits[eval(uuubits.length - 1)].indexOf(\\\".\\\") != -1) {<br \/>\n          uubits[0] = uubits[0].replace(\\\"\/\\\" + uuubits[eval(uuubits.length - 1)], \\\"\/\\\");<br \/>\n        } else {<br \/>\n          uubits[0] += \\\"\/\\\";<br \/>\n        }<br \/>\n      }<br \/>\n    }<br \/>\n<br \/>\n    var uudirname=uubits[0];<br \/>\n    var outth = inth;<br \/>\n    var ideas = new Array(\\\" href='\\\", ' href=\\\"', \\\" Href='\\\", ' Href=\\\"', \\\" HREF='\\\", ' HREF=\\\"', \\\" href=\\\", \\\" Href=\\\", \\\" HREF=\\\", \\\" src='\\\", ' src=\\\"', \\\" Src='\\\", ' Src=\\\"', \\\" SRC='\\\", ' SRC=\\\"', \\\" src=\\\", \\\" Src=\\\", \\\" SRC=\\\");<br \/>\n<br \/>\n    if (uudirname != \\\"\\\" && url != \\\"\\\") {<br \/>\n     for (m=0; m&lt;ideas.length; m++) {<br \/>\n      huhs = inth.split(ideas[m]);<br \/>\n      if (huhs.length &gt; 1) {<br \/>\n        for (ii=eval(huhs.length - 1); ii&gt;=1; ii--) {<br \/>\n          delimis=ideas[m].substring(eval(ideas[m].length - 1), eval(ideas[m].length));<br \/>\n          if (delimis == \\\"=\\\") delimis=\\\" \\\";<br \/>\n          posthuhs=huhs[ii].trim().replace(\\\"&gt;\\\",\\\" \\\").replace(\/mailto:\/g, \\\"http:\\\").replace(\/javascript:none;\/g, \\\"http:\\\").split(delimis);<br \/>\n          if (posthuhs[0].length &gt; 0) {<br \/>\n          if (posthuhs[0].substring(0,1) == \\\"#\\\" || posthuhs[0].substring(0,4).toLowerCase().replace(\/file\/g, \\\"http\\\").toLowerCase() == \\\"http\\\") {<br \/>\n              outth = outth;<br \/>\n          } else if (posthuhs[0].substring(0,1) != \\\"\/\\\" && posthuhs[0].substring(0,1) != \\\"'\\\" && posthuhs[0].substring(0,1) != '\\\"') {<br \/>\n              while (outth.indexOf(posthuhs[0]) != -1) {<br \/>\n                outth=outth.replace(posthuhs[0], \\\"youwill-never-ever-findthis\\\");<br \/>\n              }<br \/>\n              outth=outth.replace(\/youwill-never-ever-findthis\/g, uudirname + posthuhs[0]).replace(\/\\\/\\.\\\/\/g, '\/');<br \/>\n          } else if (posthuhs[0].substring(1,2) != \\\"\/\\\" && posthuhs[0].substring(0,1) != \\\"'\\\" && posthuhs[0].substring(0,1) != '\\\"') {<br \/>\n              while (outth.indexOf(posthuhs[0]) != -1) {<br \/>\n                outth=outth.replace(posthuhs[0], \\\"youwill-never-ever-findthis\\\");<br \/>\n              }<br \/>\n              outth=outth.replace(\/youwill-never-ever-findthis\/g, uudirname.substring(0, eval(uudirname.length - 1)) + posthuhs[0]).replace(\/\\\/\\.\\\/\/g, '\/');<br \/>\n          }<br \/>\n          }<br \/>\n        }<br \/>\n      }<br \/>\n     }<br \/>\n    }<br \/>\n<br \/>\n    return outth.replace(\/\\\/\\.\\\/\/g, '\/');<br \/>\n }<br \/>\n<\/code><\/p>\n<p>Why is this mapping a good idea?  Well &#8230;<\/p>\n<ul>\n<li>user interaction wise, it is great to offer a user the chance to use either relative (for brevity) or absolute (for cross domain) URLs &#8230; and yet &#8230;<\/li>\n<li>email (and a web browser address bar and curl, as two other examples) are &#8220;starting from scratch&#8221; places regarding URLs and to link to other places online, need absolute URLs to succeed<\/li>\n<\/ul>\n<p>Yet again, we have <a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/PHP\/form_creator.php---GETME\" title=\"form_creator.php\">form_creator.php<\/a>&#8216;s <a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/PHP\/form_creator.php\" title=\"Click picture\">live run<\/a> for you to try some Email (Inline) HTML.  It calls <a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/PHP\/Geographicals\/diff.php?one=http:\/\/www.rjmprogramming.com.au\/HTMLCSS\/emailhtml.php----GETME\">the changed<\/a> <a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/HTMLCSS\/emailhtml.php----GETME\">emailhtml.php<\/a> to facilitate the Email Inline HTML body.<\/p>\n<hr>\n<p id='pdfsfchpt'>Previous relevant <a target=_blank title='PDF Slideshow and Form Creation Helper Preview Tutorial' href='\/\/www.rjmprogramming.com.au\/ITblog\/pdf-slideshow-and-form-creation-helper-preview-tutorial\/'>PDF Slideshow and Form Creation Helper Preview Tutorial<\/a> is shown below.<\/p>\n<div style=\"width: 230px\" class=\"wp-caption alignnone\"><a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/PHP\/form_creator.php\"><img decoding=\"async\" style=\"border: 15px solid pink;\" alt=\"PDF Slideshow and Form Creation Helper Preview Tutorial\" src=\"http:\/\/www.rjmprogramming.com.au\/PHP\/form_creator_html_rendering_preview.jpg\" title=\"PDF Slideshow and Form Creation Helper Preview Tutorial\"  style=\"float:left;\"   \/><\/a><p class=\"wp-caption-text\">PDF Slideshow and Form Creation Helper Preview Tutorial<\/p><\/div>\n<p>Yesterday&#8217;s <a title='PDF Slideshow and Form Creation Helper Primer Tutorial' href='#pdfsfchxt'>PDF Slideshow and Form Creation Helper Primer Tutorial<\/a> suited those used to uploading data, a lot of which will involve those users knowing a bit about HTML coding, in relation to that presentation of it within an HTML <a target=_blank title='HTML textarea information from w3schools' href='http:\/\/www.w3schools.com\/tags\/tag_textarea.asp'>textarea<\/a> element.  We&#8217;re still asking you to know HTML coding as we add onto yesterday&#8217;s &#8230;<\/p>\n<ul>\n<li>HTML (or Text) view (in <a target=_blank title='HTML textarea information from w3schools' href='http:\/\/www.w3schools.com\/tags\/tag_textarea.asp'>textarea<\/a>) &#8230; with, today &#8230;<\/li>\n<li>Visual view (in overlayed new window, and available to the user via a new light blue non-form-submit button)<\/li>\n<\/ul>\n<p> &#8230; mimicking what a lot of Content Management Systems (CMS) provide for their Content Managers, that being a way HTML input data, that can be previewed by that user in a &#8220;Visual view&#8221; showing an HTML webpage rendering of that HTML coding.  This can reassure users that what they are (HTML) coding will produce a look in keeping with what they were expecting.<\/p>\n<p>In our <a target=_blank title='WordPress.org' href='http:\/\/wordpress.org'>WordPress<\/a> blog CMS they do this for the Content Writer with two tabs called &#8220;Text&#8221; (ie. the HTML coding) and &#8220;Visual&#8221; (ie. the HTML as rendered by the web browser involved).  That is cute, and easy to use, but we see the &#8220;Visual&#8221; part as optional, and don&#8217;t really wish to prioritise its use.  As well as that, it is a stepping stone to another improvement we wish to make, soon.<\/p>\n<p>Again, we have <a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/PHP\/form_creator.php--GETME\" title=\"form_creator.php\">form_creator.php<\/a>&#8216;s <a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/PHP\/form_creator.php\" title=\"Click picture\">live run<\/a> for you to try.<\/p>\n<p><b><i>Did you know?<\/i><\/b><\/p>\n<p>The HTML <a target=_blank title='HTML textarea information from w3schools' href='http:\/\/www.w3schools.com\/tags\/tag_textarea.asp'>textarea<\/a> element is truly amazing, and the performing of today&#8217;s work has clarified (some more <font size=1>&#8230; have been letting it wash over for years!<\/font>) how it works in my mind.<\/p>\n<p>There are two parts to the &#8220;content&#8221; of a textarea element we want to concentrate on.  They are its &#8220;innerHTML&#8221; (what it looks like) and its &#8220;value&#8221; (what gets passed with an HTML form as its data).<\/p>\n<p>We often, here at RJM Programming, start a textarea&#8217;s existence with HTML of a textarea with a blank &#8220;value&#8221; but a filled in &#8220;innerHTML&#8221;, and that filling in can be HTML code with all the caretted &lt; and &gt; data we get used to as Web Content managers.  Immediately, on that textarea element&#8217;s onload, that textarea will be given a &#8220;value&#8221;.<\/p>\n<p>But if you make a change to that textarea data, or even if you don&#8217;t, and go back to see the relationship &#8230;<\/p>\n<ul>\n<li>&#8220;value&#8221; is full of the caretted &lt; and &gt; characters &#8230; but &#8230;<\/li>\n<li>&#8220;innerHTML&#8221; is full of corresponding &amp;lt; and &amp;gt; <a target=_blank title='HTML enties information from Wikipedia ... thanks' href='https:\/\/en.wikipedia.org\/wiki\/List_of_XML_and_HTML_character_entity_references'>HTML entities<\/a><\/li>\n<\/ul>\n<p> &#8230; and as explainers of HTML (in online blogs and online HTML articles) around the world will know, that use of &amp;lt; and &amp;gt; within &lt;code&gt;&lt;\/code&gt; elements for instance, saves the web browser by thinking it needs to interpret the carets of HTML code, and, instead, as we the explainers would prefer too, just display the caret characters as displayed text.<\/p>\n<p>This is a topic, and it feels alive, and undertold, &#8220;The Wonders of the HTML Textarea Element&#8221;, that you, dear reader, may want to individually look into yourself, by writing your own HTML to see this textarea behaviour yourself.   And we haven&#8217;t even touched on, here, possibilities regarding setting a textarea to &#8220;readonly&#8221; true?  And how the web browsers often allow for resizing it so easily?  All fascinating!  We suspect it was fascinating to the web browser and mobile platform programmers as well, and they came up with a very powerful and useful tool for lots of online content writers out there.<\/p>\n<hr>\n<p id='pdfsfchxt'>Previous relevant <a target=_blank title='PDF Slideshow and Form Creation Helper Primer Tutorial' href='\/\/www.rjmprogramming.com.au\/ITblog\/pdf-slideshow-and-form-creation-helper-primer-tutorial\/'>PDF Slideshow and Form Creation Helper Primer Tutorial<\/a> is shown below.<\/p>\n<div style=\"width: 230px\" class=\"wp-caption alignnone\"><a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/PHP\/form_creator.php\"><img decoding=\"async\" style=\"border: 15px solid pink;\" alt=\"PDF Slideshow and Form Creation Helper Primer Tutorial\" src=\"http:\/\/www.rjmprogramming.com.au\/PHP\/form_creator.jpg\" title=\"PDF Slideshow and Form Creation Helper Primer Tutorial\"  style=\"float:left;\"   \/><\/a><p class=\"wp-caption-text\">PDF Slideshow and Form Creation Helper Primer Tutorial<\/p><\/div>\n<p>Our recent work involving the great <a target=_blank title='Fpdf PHP class' href='HTTP:\/\/www.fpdf.org\/'>Fpdf<\/a> creator of PDF files when we presented <a target=_blank href='https:\/\/www.rjmprogramming.com.au\/ITblog\/ajax-formdata-object-no-body-php-pdf-tutorial\/' title='Ajax FormData Object No Body PHP PDF Tutorial'>Ajax FormData Object No Body PHP PDF Tutorial<\/a> has got us starting on a new PDF (PHP) web application we are starting out thinking will help with &#8230;<\/p>\n<ul>\n<li>online forms (probably via thinking in terms of <a target=_blank title='Fpdf PHP class' href='HTTP:\/\/www.fpdf.org\/'>Fpdf<\/a> open source programmers like <a target=_blank title='Useful link' href='HTTP:\/\/www.fpdf.org\/en\/script\/script50.php' title='Rick van Buuren and Cl\u00e9ment Lavoillotte Fdf code, thanks'>Rick van Buuren and Cl\u00e9ment Lavoillotte<\/a>&#8216;s excellent HTML table rendering ideas) via HTML table intermediate user interactions &#8230; and &#8230;<\/li>\n<li>slideshows<\/li>\n<\/ul>\n<p> &#8230; but we will not be surprised if the project branches out into other ideas.  We&#8217;ll see over time.<\/p>\n<p>We hope you come along for the trip starting with a bit of a proof of concept <a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/PHP\/form_creator.php_GETME\" title=\"form_creator.php\">form_creator.php<\/a>&#8216;s <a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/PHP\/form_creator.php\" title=\"Click picture\">live run<\/a> for you to try, where we allow you to enter (and be able to change) some HTML table code (if that&#8217;s what you end up with?!) in a pink HTML textarea element, and that will become PDF should you click the underlying HTML form&#8217;s yellow submit button.<\/p>\n<p>Hope to see you for tomorrow&#8217;s PDF writing developments here.<\/p>\n<p>If this was interesting you may be interested in <a title='Click here to see topics in which you might be interested' href='#d46998' onclick='var dv=document.getElementById(\"d46998\"); dv.innerHTML = \"&lt;iframe width=670 height=600 src=\" + \"https:\/\/www.rjmprogramming.com.au\/ITblog\/tag\/form\" + \"&gt;&lt;\/iframe&gt;\"; dv.style.display = \"block\";'>this<\/a> too.<\/p>\n<div id='d46998' style='display: none; border-left: 2px solid green; border-top: 2px solid green;'><\/div>\n<hr>\n<p>If this was interesting you may be interested in <a title='Click here to see topics in which you might be interested' href='#d47039' onclick='var dv=document.getElementById(\"d47039\"); dv.innerHTML = \"&lt;iframe width=670 height=600 src=\" + \"https:\/\/www.rjmprogramming.com.au\/ITblog\/tag\/textarea\" + \"&gt;&lt;\/iframe&gt;\"; dv.style.display = \"block\";'>this<\/a> too.<\/p>\n<div id='d47039' style='display: none; border-left: 2px solid green; border-top: 2px solid green;'><\/div>\n<hr>\n<p>If this was interesting you may be interested in <a title='Click here to see topics in which you might be interested' href='#d47050' onclick='var dv=document.getElementById(\"d47050\"); dv.innerHTML = \"&lt;iframe width=670 height=600 src=\" + \"https:\/\/www.rjmprogramming.com.au\/ITblog\/tag\/email\" + \"&gt;&lt;\/iframe&gt;\"; dv.style.display = \"block\";'>this<\/a> too.<\/p>\n<div id='d47050' style='display: none; border-left: 2px solid green; border-top: 2px solid green;'><\/div>\n<hr>\n<p>If this was interesting you may be interested in <a title='Click here to see topics in which you might be interested' href='#d47067' onclick='var dv=document.getElementById(\"d47067\"); dv.innerHTML = \"&lt;iframe width=670 height=600 src=\" + \"https:\/\/www.rjmprogramming.com.au\/ITblog\/tag\/poll\" + \"&gt;&lt;\/iframe&gt;\"; dv.style.display = \"block\";'>this<\/a> too.<\/p>\n<div id='d47067' style='display: none; border-left: 2px solid green; border-top: 2px solid green;'><\/div>\n<hr>\n<p>If this was interesting you may be interested in <a title='Click here to see topics in which you might be interested' href='#d47077' onclick='var dv=document.getElementById(\"d47077\"); dv.innerHTML = \"&lt;iframe width=670 height=600 src=\" + \"https:\/\/www.rjmprogramming.com.au\/ITblog\/tag\/php\" + \"&gt;&lt;\/iframe&gt;\"; dv.style.display = \"block\";'>this<\/a> too.<\/p>\n<div id='d47077' style='display: none; border-left: 2px solid green; border-top: 2px solid green;'><\/div>\n<hr>\n<p>If this was interesting you may be interested in <a title='Click here to see topics in which you might be interested' href='#d47083' onclick='var dv=document.getElementById(\"d47083\"); dv.innerHTML = \"&lt;iframe width=670 height=600 src=\" + \"https:\/\/www.rjmprogramming.com.au\/ITblog\/tag\/software-integration\" + \"&gt;&lt;\/iframe&gt;\"; dv.style.display = \"block\";'>this<\/a> too.<\/p>\n<div id='d47083' style='display: none; border-left: 2px solid green; border-top: 2px solid green;'><\/div>\n<hr>\n<p>If this was interesting you may be interested in <a title='Click here to see topics in which you might be interested' href='#d47083' onclick='var dv=document.getElementById(\"d47083\"); dv.innerHTML = \"&lt;iframe width=670 height=600 src=\" + \"https:\/\/www.rjmprogramming.com.au\/ITblog\/tag\/software-integration\" + \"&gt;&lt;\/iframe&gt;\"; dv.style.display = \"block\";'>this<\/a> too.<\/p>\n<div id='d47083' style='display: none; border-left: 2px solid green; border-top: 2px solid green;'><\/div>\n<hr>\n<p>If this was interesting you may be interested in <a title='Click here to see topics in which you might be interested' href='#d47102' onclick='var dv=document.getElementById(\"d47102\"); dv.innerHTML = \"&lt;iframe width=670 height=600 src=\" + \"https:\/\/www.rjmprogramming.com.au\/ITblog\/tag\/spreadsheet\" + \"&gt;&lt;\/iframe&gt;\"; dv.style.display = \"block\";'>this<\/a> too.<\/p>\n<div id='d47102' style='display: none; border-left: 2px solid green; border-top: 2px solid green;'><\/div>\n<hr>\n<p>If this was interesting you may be interested in <a title='Click here to see topics in which you might be interested' href='#d47106' onclick='var dv=document.getElementById(\"d47106\"); dv.innerHTML = \"&lt;iframe width=670 height=600 src=\" + \"https:\/\/www.rjmprogramming.com.au\/ITblog\/tag\/input\" + \"&gt;&lt;\/iframe&gt;\"; dv.style.display = \"block\";'>this<\/a> too.<\/p>\n<div id='d47106' style='display: none; border-left: 2px solid green; border-top: 2px solid green;'><\/div>\n<hr>\n<p>If this was interesting you may be interested in <a title='Click here to see topics in which you might be interested' href='#d47113' onclick='var dv=document.getElementById(\"d47113\"); dv.innerHTML = \"&lt;iframe width=670 height=600 src=\" + \"https:\/\/www.rjmprogramming.com.au\/ITblog\/tag\/url\" + \"&gt;&lt;\/iframe&gt;\"; dv.style.display = \"block\";'>this<\/a> too.<\/p>\n<div id='d47113' style='display: none; border-left: 2px solid green; border-top: 2px solid green;'><\/div>\n","protected":false},"excerpt":{"rendered":"<p>We need more tweaking regarding the canvas rendering implications of yesterday&#8217;s PDF Slideshow and Form Creation Poll Input Tutorial, which we hope to get back to soon, but there is another matter of scope to attend to today. It sounds &hellip; <a href=\"https:\/\/www.rjmprogramming.com.au\/ITblog\/pdf-slideshow-and-form-creation-url-contents-tutorial\/\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[12,14,37],"tags":[41,2824,52,103,184,212,2531,3136,258,283,290,327,3013,380,429,3127,577,578,609,614,652,1817,2732,932,961,997,3014,2945,1045,1049,1122,1168,1185,3135,2334,3126,1319,1345,1404,1418],"class_list":["post-47113","post","type-post","status-publish","format-standard","hentry","category-elearning","category-event-driven-programming","category-tutorials","tag-_server","tag-absolute","tag-absolute-url","tag-array","tag-canvas","tag-client","tag-comma-separated-values","tag-conduit","tag-content-management-systems","tag-csv","tag-data","tag-did-you-know","tag-document-referrer","tag-email","tag-file_get_contents","tag-html-email","tag-html-entities","tag-html5","tag-input","tag-integration","tag-javascript","tag-message","tag-mimetype","tag-php","tag-poll","tag-programming","tag-referrer","tag-relative","tag-relative-url","tag-render","tag-server","tag-software-integration","tag-spreadsheet","tag-storage","tag-submit","tag-texthtml","tag-tutorial","tag-url","tag-web-browser","tag-webpage"],"_links":{"self":[{"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/posts\/47113"}],"collection":[{"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/comments?post=47113"}],"version-history":[{"count":5,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/posts\/47113\/revisions"}],"predecessor-version":[{"id":47137,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/posts\/47113\/revisions\/47137"}],"wp:attachment":[{"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/media?parent=47113"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/categories?post=47113"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/tags?post=47113"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}