nunos Posted August 17, 2009 Share Posted August 17, 2009 Hi. I haven't been able to echo a HTML piece of code from PHP due to quotes issues. This is the html code I want to echo: <td><a onclick="reenviar_email(<?php echo "'$row->email'";?>)">asd</a> Here are my PHP attemps: <?php echo '<td><a onclick="reenviar_email(' . $row->member_id . ')">asd</a>'; //works, shows box with member_id ?> <?php echo '<td><a onclick="reenviar_email(' . $row->email . ')">asd</a>'; //doesn't work, doesn't show any box ?> Javascript function: function reenviar_email(a) { var r=confirm("Reenviar o mail de activação?"); if (r==true) { alert(a); } } I have tried almost all combinations of different quotes and still haven't managed to succeed. I would appreciate any help on this. Note: $row->member_id is a number whereas $row->email is a string. I can't see how this can affect the call to the function. Thanks Link to comment https://forums.phpfreaks.com/topic/170660-solved-need-help-with-quotes/ Share on other sites More sharing options...
JonnoTheDev Posted August 17, 2009 Share Posted August 17, 2009 <td><a onclick="reenviar_email('<?php echo $row->email;?>')">asd</a> Link to comment https://forums.phpfreaks.com/topic/170660-solved-need-help-with-quotes/#findComment-900119 Share on other sites More sharing options...
nunos Posted August 17, 2009 Author Share Posted August 17, 2009 <td><a onclick="reenviar_email('<?php echo $row->email;?>')">asd</a> Thanks for you reply. I appreciate your response but what I was looking for is how to call this piece of html from an echo in php, that's where the problem is. Link to comment https://forums.phpfreaks.com/topic/170660-solved-need-help-with-quotes/#findComment-900131 Share on other sites More sharing options...
JonnoTheDev Posted August 17, 2009 Share Posted August 17, 2009 <?php echo "<td><a onclick=\"reenviar_email('".$row->email."')\">asd</a>"; ?> Link to comment https://forums.phpfreaks.com/topic/170660-solved-need-help-with-quotes/#findComment-900133 Share on other sites More sharing options...
nunos Posted August 17, 2009 Author Share Posted August 17, 2009 <?php echo "<td><a onclick=\"reenviar_email('".$row->email."')\">asd</a>"; ?> That works just great, thanks! :D Link to comment https://forums.phpfreaks.com/topic/170660-solved-need-help-with-quotes/#findComment-900140 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.