douluogu8713
douluogu8713
2018-04-26 15:06

&符号后的子字符串丢失[重复]

  • php
  • mysql

This question already has an answer here:

$mystring = "DTI ORIENTATION: CONSUMER PROTECTION & LEMON LAW";

After doing this,

$mystring = htmlspecialchars("DTI ORIENTATION: CONSUMER PROTECTION & LEMON LAW");

I'm now getting an echo of just "DTI ORIENTATION: CONSUMER PROTECTION". Even if I removed the htmlspecialchars after, the string is different now.

The words after the & sign are missing along with it. What just happened? I just want to make the & sign to be included in my string to be used in mysqli_query. Please enlighten me on this one. Thank you.

code from file1.php:

$(".t_title").click(function(){
            var title = $(this).data("title");
            var training_date = $(this).data("tdate");

            location.href = "viewTrainingAttendees.php?title=" + title + "&tdate="+ training_date; 
        });

code from viewTrainingAttendees.php:

<?php 
                        $ttitle = $_GET['title'];
                        echo $ttitle;

                     ?>
</div>
  • 点赞
  • 回答
  • 收藏
  • 复制链接分享

1条回答

为你推荐