Home > Enterprise >  Ajax return php value with html
Ajax return php value with html

Time:07-02

I'm new to programming and started land job only 1 month,have no idea how to solve these issues

1: I would like to ask how can I insert php value into location.href with quotes?

2: Why my button is unclickable even though I leave send?phone= to blank?

"<button type='button' style='height:50%;' onclick='location.href=https://api.whatsapp.com/send?phone={$num}'><i class='fa fa-whatsapp'></i>ere</button>"

enter image description here

enter image description here

CodePudding user response:

//If the button is in HTML
<button type='button' style='height:50%;' onclick='location.href=https://api.whatsapp.com/send?phone=<?php echo $num; ?>'><i class='fa fa-whatsapp'></i>ere</button>

//If you want the button in php
echo "<button type='button' style='height:50%;' onclick='location.href=\"https://api.whatsapp.com/send?phone={$num}\"'><i class='fa fa-whatsapp'></i>ere</button>";

CodePudding user response:

Your button should be like this.

<button type="button" onclick="location.href='https://api.whatsapp.com/send?phone={$num}'"><i ></i>ere</button>
  • Related