1

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

2 Answers2

1

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>
Jenz
  • 8,280
  • 7
  • 44
  • 77
0

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.

Richard de Wit
  • 7,102
  • 7
  • 44
  • 54