Jump to content

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)

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.