Including php script inside javascript confirm box

i have included a confirm box in my PHP page which works fine the following is the code

<a href="" onclick="return confirm('Acc No :   nCANDIDATE NAME :   nnPLEASE CONFIRM ')" >hi</a>

now i want to display value returned by PHP after Acc NO and CANDIDATE NAME i have written a code which is not working the code is below

<a href="" onclick="return confirm('AIN NO :<?=fetchresullt['acc_no']; ?>   nCANDIDATE NAME : <?=fetchresullt['acc_candidatename']; ?>   nnPLEASE CONFIRM ')" >hi</a>

please help me out


试试这个

<a href="" onclick="return confirm('AIN NO : "<?php echo fetchresullt['acc_no']; ?>"   nCANDIDATE NAME : "<?php echo fetchresullt['acc_candidatename']; ?>"   nnPLEASE CONFIRM ')" >hi</a>

Are you sure fetchresullt['acc_no'] is spelt correctly? Doesn't it need to be a variable? ie:

<?=$fetchresult['acc_no']?>

Also make sure you are not including it in a .js file, but make it inline JS code in a .php file.

链接地址: http://www.djcxy.com/p/59358.html

上一篇: 我不明白这个PHP代码,它在做什么?

下一篇: 包括php脚本里面的javascript确认框