Jump to content

$_GET variable question


mjurmann

Recommended Posts

Is it possible to take a variable from a URL such as admin-home.php?id=001 where 001 is the data from the id variable and then perform a series of conditional statements before the <head></head> tags. It seems that when I try to $_GET['id'] in the area before the <head> </head> tags the id variable is null. However, when I echo that same variable out in the body, the id echoes out correctly.

 

Simple question...anyone?

 

Thanks so much

Link to comment
Share on other sites

<?php

$id = $_GET['id'];
echo $id;

?>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>

  <head>
  <meta http-equiv="content-type" content="text/html; charset=windows-1250">
  <meta name="generator" content="PSPad editor, www.pspad.com">
  <title></title>
  </head>
  <body>

  </body>
</html>

 

Still worked for me =]

 

Link to comment
Share on other sites

Yes it works. I tested it.

 

It must be the header ( function. I pass the variable in the header.

 

Does anyone know if the header strips all variables and if so, is there a way around this?

 

I'm trying to let people log in and then be directed to a project page with the specific project id that was in the initial URL. The variable carries through fine but seems to get lost in the header ( function

Link to comment
Share on other sites

Thats strange, I did my own test on my own server, and everything worked out fine....

 

<?php

$id = $_GET['id'];
$new_url = "help.php?test=$id";

header("Location: $new_url");

?>

 

I don't see anything different about your code...so I have no idea what is going on.

Link to comment
Share on other sites

That is strange. I tested on another host and it works fine.

 

Does anyone know if there is something I need to turn on in order for this to work?

 

I host on GoDaddy, both of my domains are hosted on GoDaddy. However, only 1 of them allows me to do this.

Link to comment
Share on other sites

If it works on your other GoDadding account, I would say it isn't a problem with the server.

 

Try putting

error_reporting(E_ALL);

 

at the top of your script.

 

EDIT: I have no idea if the SSL server will effect anything. I guess we will have to wait until someone else comes along that can answer that.

Link to comment
Share on other sites

Error reporting results:

 

Notice: Undefined index: emailProjectID in /home/content/m/j/u/mjurmann/html/client-login-note.php on line 14

 

Line 14 has: $projectID = $_GET['emailProjectID']; 

 

Aslo:

 

 

Warning: Cannot modify header information - headers already sent by (output started at /home/content/m/j/u/mjurmann/html/client-login-note.php:14) in /home/content/m/j/u/mjurmann/html/client-login-note.php on line 46

 

 

Line 14 has: $projectID = $_GET['emailProjectID']; 

Line 46 has:  header("Location: $MM_redirectLoginSuccess");

 

 

Link to comment
Share on other sites

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.