hya all i have sorted the checkbox group out and its echoing through ok but its also echoing through userid, username twice and email address when all i want is to echo options ticked any ideals of what can be causing this please
php block at top of page:

<?php
ini_set('session.cookie_lifetime', 86400);
ini_set('session.gc_maxlifetime', 86400);
session_start();
//print_r($_SESSION);
include("config/db_connect.php");
//echo "<pre>";
//echo $all_interests_value = implode(",",$_POST);
//print_r($_POST);
if (isset($_POST['submit'])) {
@$_SESSION["option1"]=$_REQUEST['option1'];
@$_SESSION["option2"]=$_REQUEST['option2'];
@$_SESSION["option3"]=$_REQUEST['option3'];
@$_SESSION["option4"]=$_REQUEST['option4'];
}
$check_exist_qry="select * from interests";
$run_qry=mysqli_query($conn,$check_exist_qry);
$total_found=mysqli_num_rows($run_qry);
if($total_found >0)
{
    $my_value=mysqli_fetch_assoc($run_qry);
    $my_stored_interests=explode(',',$my_value['interest_name']);
}


if(isset($submit))
{
    $all_interests_value = implode(",",$_POST);
    if($total_found >0)
    {
        //update
        $upd_qry="UPDATE interests SET interest_name='".$all_interests_value."'";
        mysqli_query($conn,$upd_qry);

    }
    else
    {
        //insert
        $ins_qry="INSERT INTO interests(interest_name) VALUES('".$all_interests_value."')";
        mysqli_query($conn,$ins_qry);
    }
}
?>

The html block:

<html> <head> <title></title> </head> <body> <?php
if (isset($_POST['submit'])) {
echo "<ul>";
foreach ($_SESSION as $value) {
if($value!="")
{
echo "<li>$value</li>";
}
}
echo "</ul>";
} else
{
echo "<ul>";
foreach ($_SESSION as $value) {
if($value!="")
{
echo "<li>$value</li>";
}
}
echo "</ul>";
}
?> </body> </html>

Any help would be much appreicated p.s sorry for long coding x

Personally, I don't think you should be using the sesson variable like this. It is likely the root of your problem as well.

If you need a "stateful" system, that's what the database is for - even for temporary things. It's ok to delete from the database.

he didnt put the session variable in i paid a freelancer to sort it so would it be safe to remove the session variables hun

i have the items going to the database but the profile page isnt picking it up although ive put to fetch it from database like the following:

php section

// Fetch Interests for profile interests
$interest_name = $fetch_interests['interest_name'];

$interests_query        = mysqli_query($conn,"select * from interests where user_id = '".$fetch_interests['user_id']."' ");
$fetch_interests        = mysqli_fetch_array($interests_query);

html section

<div class="profl_title"> Interests</div>
        <div class="clr"></div>
      </div>
      <div class="clr"></div>
      <div class="profl_contnt">

      <?php echo $fetch_interests['interest_name'];?>

     <div class="clr"></div>
      </div>
Member Avatar for diafol

he didnt put the session variable in i paid a freelancer to sort it so would it be safe to remove the session variables hun

Who.s he? Confused. This is not your code?? The freelancer did something then "he" did something? WTF?

sorry typing mistake i didnt create the code i paid a freelancer

Then you need him to support his code. And not use awful error suppressing for no reason. If that code is producing errors, you got a lot of other things to worry about :-/

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.