Wednesday, February 5, 2014

PHP: transfer long data to url variable




In the following example, I have a pubmed abstract stored in $choppeddata and I want to transfer to a url variable in a popup up windows. Later I can use $_GET to obtain the value.  PHP function urlencode is used to deal with space and non-alphanumeric characters properly.
 code
<?php
$chosenperson = 2255;
$choppeddata = "1: Park YJ, Woo M, Kieffer TJ, Hakem R, Safikhan N, Yang F, Ao Z, Warnock GL, Marzban L. The role of caspase-8 in amyloid-induced beta cell death in human and mouse islets. Diabetologia. 2014 Jan 19. [Epub ahead of print] PubMed PMID: 24442508."
 $puburldata=urlencode($choppeddata);
?>
 <a class="txt-button" onclick="javascript:void window.open('test.php?person=<?php print $chosenperson;  ?>&pubabstract=<?php print $puburldata;  ?>','child','width=900,height=500,resizable=false,left=0,top=0' );return false;">To add a new pubmed, please click this link and fill in its details</a>

No comments:

Post a Comment