0

Is it possible to have a link submit to self with GET variables in it?

<a href='#?id=1234&c=2' data-toggle='modal' data-target='#mymodal'></a>

Then when clicked the URL would look like this -

example.com/test.php?msg=hello#?id=1234&c=2

But it doesn't work / PHP doesn't see any of the variables after the #.

I have the following code on the same page (for testing) -

echo $_GET['id'];

And I want it to echo 1234

Is there another way to do this?

Thanks!

AS3
  • 3
  • 4

1 Answers1

0

If you want the query params you should put them before "#" and not after. When You put them after it, then your php script "won't see" them. Check out this answer on superuser for more.

Also your url example "example.com/test.php?msg=hello#?id=1234&c=2" has 2 "?" in it and it should not.

guessimtoolate
  • 8,372
  • 2
  • 18
  • 26