I've a script that assigns varibale to a specific session. It works perfectly on localhost but after uploading online, it just wouldn't work on the web. i.e
Here is the link that sends the variable through $_GET to the script
<a href="user_entry_chk.php?pubc_req&c_id=<?php echo $course_details['id']; ?>">Register for this course</a>
Here's the script meant to assign variable to the session
if (isset($_REQUEST['pubc_req'])) {
$c_id = $_GET['c_id'];
session_name("pubc_cart");
session_start();
$pubc_cart = $_SESSION[pubc_cart];
if ($pubc_cart) {
//$get_pub_arr[] = array();
$pubc_cart = $_SESSION[pubc_cart];
$get_pubc_arr[] = array();
$get_pubc_arr = $_SESSION[pubc_cart];
if(in_array($c_id, $get_pubc_arr)){
//$_SESSION['inh_cart'] = array();
?>
<script language="javascript">
window.location = "user_allc_booking.php?ex_pub_cid=<?php echo $c_id; ?>";
</script>
<?php
}
else {
//$_SESSION['pubc_cart'] = array();
$_SESSION[pubc_cart][] = $c_id;
//$pubc_cart[] = array();
//$pubc_cart = $_SESSION['pubc_cart'];
}
} else {
$_SESSION[pubc_cart][] = $c_id;
//$pubc_cart[] = array();
//$pubc_cart = $_SESSION['pubc_cart'];
}
//$_SESSION['pubc_cart'] = $pubc_cart;
?>
<script language="javascript">
window.location = "user_allc_booking.php";
</script>
<?php
$pub_query_course_info = @mysql_query("select * from public_courses where id='".$c_id."'");
$pub_course_det = array();
$pub_course_det = @mysql_fetch_assoc($pub_query_course_info);
$pub_course_title = $pub_course_det['title'];
}
In addition:
There's another session that works perfectly both locally and on the web for the same application.
This session is $_SESSION['member_id']
The member_id session handles the login id for all users while registering for courses. It's working fine except for the pubc_cart which holds the course id.
Im really puzzled. Is there another way to assign variable to session different from this or do you have to write a different script locally and then a different one for the web... Pls I'm really confused here.. Would be glad to get help.