问题
I have string parameter with apostrophes that I need to pass it to another php page. My code is:
echo '<form name="submitForm2" action="creatDocument.php?$formulation='.$formulation.'" method="POST">
         <input type="submit" value="pass"/>
         </form>';
The $fomulation parameter contain the string with hebrew characters that came from user.
if $fomulation = אבג"דה
creatDocument.php received just $fomulation = אבג .
How can I fix it?
回答1:
What's happening is that the URL parser is breaking on the single quotes. Check out the URLEncode method, to encode your query string parameters.
http://us3.php.net/urlencode
回答2:
echo '<form name="submitForm2" action="creatDocument.php?$formulation='.urlencode(utf8_encode($formulation)).'" method="POST">
     <input type="submit" value="pass"/>
     </form>';
    来源:https://stackoverflow.com/questions/22988281/php-parameter-with-apostrophes