Jump to content

Little Help Needed


mpatel

Recommended Posts

hi guys help needed here as i cant figure out these error as i am new to this

 

Deprecated: Function session_register() is deprecated in C:\xampp\htdocs\index.php on line 3

 

Notice: Undefined index: id in C:\xampp\htdocs\index.php on line 4

 

 

<?php

session_start();

session_register("refid_session");

$id=$_GET['id'];

if($id !="") {

if($_SESSION["refid_session"]=="") {

$_SESSION["refid_session"]=$id ;

}

}

include "default.php";

?>

 

Link to comment
Share on other sites

first of all thanks for fast reply. my friend told me where ever it is throwing the undefined index error, use the language construct isset() to check if the value for 'id' has been set. you already used isset then also isuue not solved :'(

 

Link to comment
Share on other sites

if $_GET['id'] isn't always going to be specified, you should either throw an error or set a default value if need be, like so:

<?php
session_start();
if(isset($_GET['id'])) {
if(!isset($_SESSION["refid_session"])) {
   $_SESSION["refid_session"] = $_GET['id'];
}
} else {
   // either error or default value
   echo "No ID was set!";
}
include "default.php";
?>

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.