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