Tell me, I ran into such a problem. Wrote a form to send a message. Everything is sent normally, but the caveat is that the following is not sent on the form

To: <a href="<?php echo $myrow[id]; ?>"><?php echo $myrow[fname]; ?> <?php echo $myrow[lname]; ?></a> 

And it is necessary that this data is also transmitted. Is it possible to do this? And how to take them later in php? Here is the jQuery script? which sends data from the php handler form:

 $(function () { $("#send").click(function () { $.ajax({ url: "senmess.php", type: "POST", cache: false, dataType: 'html', success: function (html) { $(".container").html(html); } }); }); }); 

Tell me, please, what is the problem. Thank you in advance!

    1 answer 1

    For convenience, write this data in separate variables. For example, if you add id to the link:

      To: <a id="link" lname="<?= $myrow[lname] ?>" fname="<?= $myrow[fname] ?>" href="<?php echo $myrow[id]; ?>"><?= $myrow[fname]; ?> <?= $myrow[lname]; ?></a> var href = $("#link").attr('href'); var fname = $("#link").attr('fname'); var lname = $("#link").attr('lname'); $(function () { $("#send").click(function () { $.ajax({ url: "senmess.php", type: "POST", cache: false, data: {"vals[]": [href, fname, lname] }, dataType: 'html', success: function (html) { $(".container").html(html); } }); }); });