Reputation: 21
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 : \n\nPLEASE 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']; ?> \n\nPLEASE CONFIRM ')" >hi</a>
please help me out
Upvotes: 1
Views: 265
Reputation: 8369
Try with this
<a href="" onclick="return confirm('AIN NO : "<?php echo fetchresullt['acc_no']; ?>" \nCANDIDATE NAME : "<?php echo fetchresullt['acc_candidatename']; ?>" \n\nPLEASE CONFIRM ')" >hi</a>
Upvotes: 1
Reputation: 7452
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.
Upvotes: 0