0
<script>
var queryString = window.location.search;
queryString = queryString.substring(1);
</script>
<?php
include("assignmentd.php");
$array;
$id=$_COOKIE['id'];
$count = "<script>document.write(queryString)</script>";
$count1=$count;
echo $count;
print_r(parse_str($count1,$array));
print_r($array);
//$q3="INSERT INTO previous_year(clicks)VALUES('$fcount') where id='$id'";
        //$m3=mysqli_query($conn,$q3);
?>

I am taking this query String from some other html page but my parse string is not working on $count htmlpage from the quesry string is coming is

<input type="button" value="click me" onClick="count1()"><br>
<input type="button"  value="log out" onClick="logout()">
<script>
var count=0;
function count1()
{
    alert("in count");
    count++;
    alert(count);
}
function logout()
{
    alert("in logout");
    var queryString = "?para1=" + count;
    window.location.href = "previous_year_logout.php" + queryString;
}
</script>
SATYAM SAREEN
  • 41
  • 2
  • 8

1 Answers1

1

Only a URL string can be parsed. You can't have script tags in parse string and you can't execute javascript on PHP like html.

Use a form to submit the data and then you access it using $_GET.

Candy Crunch
  • 100
  • 10