Jump to content

[SOLVED] Need help with quotes


nunos

Recommended Posts

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.