Here is the code from my submit.php file that has the form mentioned in the title. The if and while statements work and all of this code works the way it looks.
<form action="file.php" method="post">
<?php //database connection stuff
...
if($result->num_rows > 0){
echo '<div class="pure-g">';
while($row = $result->fetch_assoc()){
echo '<div class="l-box pure-u-1 pure-u-md-1-2 pure-u-lg-1-5">
<fieldset id="' . $row[Name] . '">
<h3 class="content-subhead">'
. $row[Name] . '
</h3>
<img src="' . $row[Picture] . '" width="100" height="100">
<input type="checkbox" name="check" id="check' . $row[Name] . '" value="' . $row[Name] . ',">
</fieldset>
</div>';
}
echo '</div>';
}
else{
echo "0 results";
}
?>
</div>
<input type="submit" value="Add Selected Games">
</form>
The problem I'm getting is when I use the submit.php:
$conn = mysql_connect($host, $name, $pass);
if(!$conn){
echo "cannot connect to server" . mysql_error();
}
$select = mysql_select_db($db);
if(!$select){
echo "cannot select db" . mysql_error();
}
$list = $_REQUEST['check'];
echo " success $list";
There are currently 3 checkboxes showing on the file.php page that will list the fieldset objects. How should I name the checkbox to have it echo the right $row[Name]? It will echo one $row[Name] based on the a checkbox being checked and newest checkbox (created later in the while loop).