searls03 Posted September 4, 2011 Share Posted September 4, 2011 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 Quote Link to comment https://forums.phpfreaks.com/topic/246384-select-pieces-from-checkboxess/ Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.