posting php variable that contains apostrophe

Posted by user1658170 on Stack Overflow See other posts from Stack Overflow or by user1658170
Published on 2012-10-28T16:58:12Z Indexed on 2012/10/28 16:59 UTC
Read the original article Hit count: 431

Filed under:
|
|
|

I am having trouble posting a php variable to another page. The variable is retrieved from a dropdown selected by the user and if it contains an apostrophe, I only get the part prior to the apostrophe posted. I.E. If I want to post "Cooper's Hawk" I am only receiving "Cooper". How do I escape this properly so that I can post the entire string?

This is what I have:

 echo '<form method="POST" action="advanced_search2.php">';
 $dropdown_english_name = "<select class = 'dropdown' name='english_name'>     <option>ALL</option>";

 $posted_value = ($_POST['english_name']);
 echo;$posted_value;die;

So, to clarify from the above code, the posted string is "cooper's hawk" but the echoed output is "Cooper". Thanks in advance for any tips.

© Stack Overflow or respective owner

Related posts about php

Related posts about post