Jump to content

Page don't picks variables with $_GET


Emperio

Recommended Posts

Hi all,

I got this url which sendes variables to the other page,

preax.php?naam=X1?id=X2

 

now i got this code in the next page which must take the variables from the url,

<?php

include 'connect.php';

session_start();

?>

 

<link rel="stylesheet" href="style.css" type="text/css">

<?php

if (isset($_SESSION['player']))

  {

    $player=$_SESSION['player'];

    $userstats="SELECT * from users where playername='$player'";

    $userstats2=mysql_query($userstats) or die("Could not get user stats");

    $userstats3=mysql_fetch_array($userstats2);

      $id = $_GET['id'];

      $naam = $_GET['naam'];

      echo "Name:$naam";

      echo "ID:$id";

}

else

  {

    print "Sorry, not logged in  please <A href='login.php'>Login</a><br>";

 

  }

 

?>

When i echo them i dont get them can someone help me with this?

Link to comment
https://forums.phpfreaks.com/topic/188371-page-dont-picks-variables-with-_get/
Share on other sites

the URL parameters are formatted incorrectly.

 

When you send $_GET data, you append a ? at the end of the filename (IE page.php?) and then you add the variables (IE page.php?id=5) if you have multiple variables, after the first variable, you separate them with the ampersand (&) IE (page.php?id=5&other=6)

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.