I'm trying to pass a name with an apostrophe as a hidden variable to a following function.
When displaying $LName in function F2, all characters after the apostrophe are missing.
Note: php.ini has 'magic_quotes_gpc = On'
Why is the apostrophe causing the trailing characters to be removed?
How can I correct this?
Thanks
-Tim
<?php
define (FUNCT1, 0);
define (FUNCT2,1);
define ('NL', '<BR>');
if (!$action){ $action=0;}
function F1()
{
$LName="O'kelly";
echo "Function: F1" . NL;
echo "LName: $LName" . NL ;
printf("<form method=\"post\" action=\"%s?action=%d\">\n", $PHP_SELF, FUNCT2 );
echo "<INPUT TYPE='hidden' NAME='LName' VALUE='$LName'>";
echo "<INPUT type='SUBMIT' value='Submit Hidden'></form>";
}
function F2()
{
global $PHP_SELF, $LName;
echo "Function: F2" . NL;
echo "LName: $LName" . NL ;
printf("<form method=\"post\" action=\"%s?action=%d\">\n", $PHP_SELF, FUNCT1);
echo "<INPUT type='SUBMIT' value='Next'>";
}
switch ($action) {
case FUNCT1:
F1();
break;
case FUNCT2:
break;
default:
echo ("unknown action: $action");
};
?>