Jump to content

select pieces from checkboxess


searls03

Recommended Posts

so I need to know how to make it so that this code

<?php
session_start(); // Must start session first thing
/*
Created By Adam Khoury @ [url='http://www.flashbuilding.com/']www.flashbuilding.com[/url]
-----------------------June 20, 2008-----------------------
*/
// Here we run a login check
if (!isset($_SESSION['id'])) {
echo 'Please <a href="/login.php">log in</a> to access your account';
exit();
}
//Connect to the database through our include
include_once "connect_to_mysql.php";
// Place Session variable 'id' into local variable
$userid = $_SESSION['id'];
if (isset($_POST['submitted'])) {
include('connect1.php');
$category = "name";
$criteria = $_POST['criteria'] ;
setcookie("criteria", $criteria, time()+10);
setcookie("category", $category, time()+10);
$query = ("SELECT name, badges, rank, userid FROM members WHERE $category LIKE '%".$criteria."%'");
$result = mysqli_query($dbcon, $query) or die('error getting data');
setcookie("query12", $query, time()+10);
}
// Process the form if it is submitted
$sql = mysql_query("SELECT * FROM members WHERE userid='$userid'");
while($row = mysql_fetch_array($sql)){
$name = $row["name"];
$phone = $row["phone"];
$username = $row["username"];
$address = $row["address"];
$city = $row["city"];
$state = $row["state"];
$zip = $row["zip"];
$cell = $row["cell"];
$email = $row["email"];
$accounttype = $row["accounttype"];
$rank = $row["rank"];
$badges = $row["badges"];
}
?>

 

will select all people from this code that are checked and will still set cookies. 

<?php    
    
    $select = mysql_query("SELECT * FROM members") or die(mysql_error());
    while ($member = mysql_fetch_array($select)) {
        echo '<input type="checkbox" name="criteria" value="'.$member[name].'">'.$member[name].'<br>';
    }
    
?>

 

I have results displaying later on and it only displays the last name checked.  please help.  I can't figure out what to use here :(

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.