I have used below code:
$html = '';
$html. = '<br></br>';
$html .= '<a href= "javascript:void(0)" class= "test" onclick= "get_data($access_token,1,$marketTagId);">Next 50 </a>';
but my PHP variables are not recognized.
I have used below code:
$html = '';
$html. = '<br></br>';
$html .= '<a href= "javascript:void(0)" class= "test" onclick= "get_data($access_token,1,$marketTagId);">Next 50 </a>';
but my PHP variables are not recognized.
According to this Stackoverflow answer:
\'
, and to display a back slash, you can escape it with another backslash \\
(So yes, even single quoted strings are parsed).$type
and you what to echo "The $types are"
That will look for the variable $types
. To get around this use echo "The {$type}s are"
You can put the left brace before or after the dollar sign. Take a look at string parsing to see how to use array variables and such.They are not recognized, because you have put all your string in single quotes ('
).
You should replace them all with double quotes ("
).
$html = "";
$html. = "<br></br>";
$html .= "<a href=\"javascript:void(0)\" class=\"test\" onclick=\"get_data('$access_token',1,'$marketTagId');\">Next 50</a>";
Also you have the option of separating your variables from text:
$html = '';
$html. = '<br></br>';
$html .= '<a href="javascript:void(0)" class="test" onclick="get_data("' . $access_token . '",1,"' . $marketTagId . '");">Next 50</a>';
If you don't want to escape so many double quotes, you may use single quotes instead:
$html = "";
$html. = "<br></br>";
$html .= "<a href='javascript:void(0)' class='test' onclick='get_data(\"$access_token\",1,\"$marketTagId\");'>Next 50</a>";
Try this, it might help you
<?php
$html = '';
$html. = '<br></br>';
$html .= '<a href= "javascript:void(0)" class= "test" onclick= "get_data($access_token,1,'.$marketTagId.');">Next 50</a>';
?>
Try this
get_data('".$access_token."',1,'".$marketTagId."');
Or
get_data(<?php $access_token ?>,1,<?php $marketTagId ?> );
You need to write ''
around your PHP variables otherwise in onclick
function they will not worked.
Use below code:-
$html = '';
$html. = '<br></br>';
$html .= "<a href= 'javascript:void(0)' class= 'test' onclick= \"get_data('$access_token','1','$marketTagId');\">Next 50 </a>";
Hope it will help you :)
Use the php variables within {
and }
$access_token = "1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZ";
$marketTagId = "__AAA__B_123";
$html = "";
$html .= "<br></br>";
$html .= "<a href=\"javascript:void(0)\" class=\"test\" onclick=\"get_data('{$access_token}',1, '{$marketTagId}')\">Next 50</a>";
echo htmlentities($html);
your code:
$html. = '<br></br>';
$html .= '<a href= "
change to this:
$html.= '<br></br>';
$html.= '<a href= "
try this:
$html = '';
$html.= '<br></br>';
$html.= '<a href= "javascript:void(0)" class= "test" onclick= "get_data($access_token,1,$marketTagId);">Next 50 </a>';
Hi All Thanks for helping. This is worked for me :
$html .= '</table>';
$html .= '<br><br>';
$html .= '<a href= "javascript:void(0)" class= "test" onclick= \'get_data("'.$access_token.'","1","'.$marketTagId.'");\'>Next 50 </a>';