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
https://forums.phpfreaks.com/topic/245182-little-help-needed/
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
https://forums.phpfreaks.com/topic/245182-little-help-needed/#findComment-1259344
Share on other sites

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.