Quotation marks inside quotation marks (html, php)

Asked

Viewed 87 times

0

I have an html code and I would like to put in the tag that is inside the onclick event of a button, the address that it should go to after clicking on "YES", but I think I’m missing the quotation marks. Instead of him creating the button with the correct notification, this is what is happening with the button.

botão fica assim

How to fix redirect to this onclick? Follow html code below.

                                                        <button class="btn btn-danger btn" id="excluir" onclick="return toastr.warning('Deseja realmente excluir o produto <?= $value['nome_ProdutosEmpresa'];?>?<br><br><a href="<?= base_url('produtos/atualizar/' . $value['id']) ;?>">SIM</a>')">
   <i class="icon-times" style="width: 12px; text-align: center"></i>
</button>

  • 2

    Crossbow question: why put all this right on onclick of the element instead of defining a function in the JS and just running it in the click?

  • Thanks for the help... if I’m asking this way is because I want to understand what I’m missing, I know I can use the way you said, but my question was not that, hugs

1 answer

0

At the time of setting href, a point is missing after $value['id'], I can initially only notice this error.

 <button class="btn btn-danger btn" id="excluir" onclick="return toastr.warning('Deseja realmente excluir o produto <?= $value['nome_ProdutosEmpresa'];?>?<br><br><a href="<?= base_url('produtos/atualizar/' . $value['id'] .'') ;?>">SIM</a>')">
 <i class="icon-times" style="width: 12px; text-align: center"></i>
</button>

Browser other questions tagged

You are not signed in. Login or sign up in order to post.