alfredviegas Posted June 25, 2008 Share Posted June 25, 2008 Hi, I am developing a family tree website and I am facing an issue with passing variables that have a single quote. My code is as follows $childName="David D\'Souza"; // this value comes from the database echo "<td align='center' cellpadding='9'>"; echo "<a href='family.php?parent_name=$root_father&childName=".$child_name."'>".$childName."</a></td>"; When i try to put my mouse cursor over this link to pass the variable to the next page, all i get is David D\ instead of getting the whole name: David D\'Souza What do i need to do in order the entire variable sent to the next page. Link to comment https://forums.phpfreaks.com/topic/111793-issue-with-passing-a-variable-that-has-a-single-quote/ Share on other sites More sharing options...
zenag Posted June 25, 2008 Share Posted June 25, 2008 echo "<a href='family.php?parent_name=$root_father&childName=".htmlentities($childName, ENT_QUOTES)."'>".$childName."<a></td>"; Link to comment https://forums.phpfreaks.com/topic/111793-issue-with-passing-a-variable-that-has-a-single-quote/#findComment-573919 Share on other sites More sharing options...
rupam_jaiswal Posted June 25, 2008 Share Posted June 25, 2008 Try this if it works echo '<a href="family.php?parent_name=$root_father&childName='.$childName.'">'.$childName.'[/url]</td>'; Link to comment https://forums.phpfreaks.com/topic/111793-issue-with-passing-a-variable-that-has-a-single-quote/#findComment-573923 Share on other sites More sharing options...
alfredviegas Posted June 26, 2008 Author Share Posted June 26, 2008 echo "<a href='family.php?parent_name=$root_father&childName=".htmlentities($childName, ENT_QUOTES)."'>".$childName."<a></td>"; Hey Thanks a lot.. your code worked!!!! Link to comment https://forums.phpfreaks.com/topic/111793-issue-with-passing-a-variable-that-has-a-single-quote/#findComment-574617 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.