Please help -- Checkboxes -- So close, yet so far...
I have a form that has a number of checkboxes. Upon initial submission, the values of the checked boxes are stored as one variable via "implode" and placed into my database.
In an effort to make the form editable (that is, a user can select/deselect boxes as they wish) , I've been trying to place "checked" inside the input tag for the values that are actually in the database.
But, I can't figure out how to check to see if that particular item is in the database... I've pasted the code below and indicated where I'm having a problem.
Code: Select all
$array = array('Milk', 'Eggs', 'Bread', 'Lettuce' , 'Cookies');
$query = "SELECT * FROM qtable WHERE id='$did'";
$result = @mysql_query ($query);
while($row=mysql_fetch_array($result)) {
$item=$row['items'];
$brd=$row['brand'];
$st=$row['store'];
}
foreach ($array as $item) {
if ( $item is in database) // THIS IS WHERE I'M STUCK
$chk = 'checked';
else
$chk = '';
echo "<input type='checkbox' name='$item' value='1' $chk> $item<br>";
}In an effort to make the form editable (that is, a user can select/deselect boxes as they wish) , I've been trying to place "checked" inside the input tag for the values that are actually in the database.
But, I can't figure out how to check to see if that particular item is in the database... I've pasted the code below and indicated where I'm having a problem.
Code: Select all
$array = array('Milk', 'Eggs', 'Bread', 'Lettuce' , 'Cookies');
$query = "e;SELECT * FROM qtable WHERE id='$did'"e;;
$result = @mysql_query ($query);
while($row=mysql_fetch_array($result)) {
$item=$rowї'items'];
$brd=$rowї'brand'];
$st=$rowї'store'];
}
foreach ($array as $item) {
if ( $item is in database) // THIS IS WHERE I'M STUCK
$chk = 'checked';n, the values of the checked boxes are stored as one variable via "implode" and placed into my database.
In an effort to make the form editable (that is, a user can select/deselect boxes as they wish) , I've been trying to place "checked" inside the input tag for the values that are actually in the database.
But, I can't figure out how to check to see if that particular item is in the database... I've pasted the code below and indicated where I'm having a problem.Code: Select all
$array = array('Milk', 'Eggs', 'Bread', 'Lettuce' , 'Cookies');
$query = "e;SELECT * FROM qtable WHERE id='$did'"e;;
$result = @mysql_query ($query);
while($row=mysql_fetch_array($result)) {
$item=$rowї'items'];
$brd=$rowї'brand'];
$st=$rowї'store'];
}
foreach ($arrayvariable via "implode" and placed into my database.
In an effort to make the form editable (that is, a user can select/deselect boxes as they wish) , I've been trying to place "checked" inside the input tag for the values that are actually in the database.
But, I can't figure out how to check to see if that particular item is in the database... I've pasted the code below and indicated where I'm having a problem.Code: Select all
$array = array('Milk', 'Eggs', 'Bread', 'Lettuce' , 'Cookies');
$query = "e;SELECT * FROM qtable WHERE id='$did'"e;;
$result = @mysql_query ($query);
while($row=mysql_fetch_array($result)) {
$item=$rowї'items'];
$brd=$rowї'brand'];
$st=$rowї'store'];
}
foreach ($array as $item) {
if ( $item is in databas are stored as one variable via "implode" and placed into my database.
In an effort to make the form editable (that is, a user can select/deselect boxes as they wish) , I've been trying to place "checked" inside the input tag for the values that are actually in the database.
But, I can't figure out how to check to see if that particular item is in the database... I've pasted the code below and indicated where I'm having a problem.Code: Select all
$array = array('Milk', 'Eggs', 'Bread', 'Lettuce' , 'Cookies');
$query = "S
I have a form that has a number of checkboxes. Upon initial submission, the values of the checked boxes are stored as one variable via "implode" and placed into my database.
In an effort to make the form editable (that is, a user can select/deselect boxes as they wish) , I've been trying to place "checked" inside the input tag for the values that are actually in the database.
But, I can't figure out how to check to see if that particular item is in the database... I've pasted the code below and indicated where I'm having a problem.Code: Select all
$array = array('Milk', 'Eggs', 'Bread', 'Lettuce' , 'Cookies');
$query = "e;SELECT * FROM qtable WHERE id='$did'"e;;
$result = @mysql_query ($query);
while($row=mysql_fetch_array($result)) {
$item=$rowї'items'];
$brd=$rowї'brand'];
$st=$rowї'store'];
}
foreach ($array as $item) {
if ( $item is in database) // THIS IS WHERE I'M STUCK
$chk = 'checked';
else
$chk = '';
echo "e;<input type='checkbox' name='$item' value='1' $chk> $item&
I have a form that has a number of checkboxes. Upon initial submission, the values of the checked boxes are stored as one variable via "implode" and placed into my database.
In an effort to make the form editable (that is, a user can select/deselect boxes as they wish) , I've been trying to place "checked" inside the input tag for the values that are actually in the database.
But, I can't figure out how to check to see if that particular item is in the database... I've pasted the code below and indicated where I'm having a problem.Code: Select all
$array = array('Milk', 'Eggs', 'Bread', 'Lettuce' , 'Cookies');
$query = "SELECT * FROM qtable WHERE id='$did'";
$result = @mysql_query ($query);
while($row=mysql_fetch_array($result)) {
$item=$row['items'];
$brd=$row['brand'];
$st=$row['store'];
}
foreach ($array as $item) {
if ( $item is in database) // THIS IS WHERE I'M STUCK
$chk = 'checked';
else
$chk = '';
echo "<input type='checkbox' name='$item' value='1' $chk> $item<br>";
}$query = "SELECT * FROM qtable WHERE id='$did'";
$result = @mysql_query ($query);
while($row=mysql_fetch_array($result)) {
$item=$row['items'];
$brd=$row['brand'];
$st=$row['store'];
}
foreach ($array as $item) {
if ( $item is in database) // THIS IS WHERE I'M STUCK
$chk = 'checked';
else
$chk = '';
echo "<input type='checkbox' name='$item' value='1' $chk> $item<br>";
}
w['brand'];
$st=$row['store'];
}
foreach ($array as $item) {
if ( $item is in database) // THIS IS WHERE I'M STUCK
$chk = 'checked';
else
$chk = '';
echo "<input type='checkbox' name='$item' value='1' $chk> $item<br>";
}
on, the values of the checked boxes are stored as one variable via "implode" and placed into my database.
In an effort to make the form editable (that is, a user can select/deselect boxes as they wish) , I've been trying to place "checked" inside the input tag for the values that are actually in the database.
But, I can't figure out how to check to see if that particular item is in the database... I've pasted the code below and indicated where I'm having a problem.
Code: Select all
$array = array('Milk', 'Eggs', 'Bread', 'Lettuce' , 'Cookies');
$query = "SELECT * FROM qtable WHERE id='$did'";
$result = @mysql_query ($query);
while($row=mysql_fetch_arrhecked boxes are stored as one variable via "implode" and placed into my database.
In an effort to make the form editable (that is, a user can select/deselect boxes as they wish) , I've been trying to place "checked" inside the input tag for the values that are actually in the database.
But, I can't figure out how to check to see if that particular item is in the database... I've pasted the code below and indicated where I'm having a problem.Code: Select all
$array = array('Milk', 'Eggs', 'Bread', 'Lettuce' , 'Cookies');
$query = "e;SELECT * FROM qtable WHERE id='$did'"e;;
$result = @mysql_query ($query);
while($row=mysql_fetchckboxes. Upon initial submission, the values of the checked boxes are stored as one variable via "implode" and placed into my database.
In an effort to make the form editable (that is, a user can select/deselect boxes as they wish) , I've been trying to place "checked" inside the input tag for the values that are actually in the database.
But, I can't figure out how to check to see if that particular item is in the database... I've pasted the code below and indicated where I'm having a problem.Code: Select all
$array = array('Milk', 'Eggs', 'Bread', 'Lettuce' , 'Cookies');
$query = "SELECT * FROM qtable WHERE id='$did'";
$result = @mysql_query ($query);
while($row=mysql_fetch_array($result)) {
$item=$row['items'];
$brd=$row['brand'];
$st=$row['store'];
}
foreach ($array as $item) {
if ( $item is in database) // THIS IS WHERE I'M STUCK
$chk = 'checked';
else
$chk = '';
echo "<input type='checkbox' name='$itert to make the form editable (that is, a user can select/deselect boxes as they wish) , I've been trying to place "checked" inside the input tag for the values that are actually in the database.
But, I can't figure out how to check to see if that particular item is in the database... I've pasted the code below and indicated where I'm having a problem.Code: Select all
$array = array('Milk', 'Eggs', 'Bread', 'Lettuce' , 'Cookies');
$query = "e;SELECT * FROM qtable WHERE id='$did'"e;;
$result = @mysql_query ($query);
while($row=mysql_fetch_array($result)) {
$item=$rowї'items'];
$brd=$rowї'brand'];
$st=$rowї'store'];
}
foreach ($array as $item) {
if ( $item is in database) // THIS IS WHERE I'M STUCK
$chk = 'checked';
else
$chk = '';
echo "e;<input type='checkbox' name='$item' value='1' $chk&a are actually in the database.
But, I can't figure out how to check to see if that particular item is in the database... I've pasted the code below and indicated where I'm having a problem.Code: Select all
$array = array('Milk', 'Eggs', 'Bread', 'Lettuce' , 'Cookies');
$query = "SELECT * FROM qtable WHERE id='$did'";
$result = @mysql_query ($query);
while($row=mysql_fetch_array($result)) {
$item=$row['items'];
$brd=$row['brand'];
$st=$row['store'];
}
foreach ($array as $item) m that has a number of checkboxes. Upon initial submission, the values of the checked boxes are stored as one variable via "implode" and placed into my database.
In an effort to make the form editable (that is, a user can select/deselect boxes as they wish) , I've been trying to place "checked" inside the input tag for the values that are actually in the database.
But, I can't figure out how to check to see if that particular item is in the database... I've pasted the code below and indicated where I'm having a problem.Code: Select all
$array = array('Milk', 'Eggs', 'Bread', 'Lettuce' , 'Cookies');
$query = "SELECT * FROM qtable WHERE id='$did'";
$result = @mysql_query ($query);
while($row=mysql_fetch_array($result)) {
$item=$row['items'];
$brd=$row['brand'];
$st=$row['store'];
}
foreach ($array as $item) {
if ( $item is in database) // THIS IS WHERE I'M STUCK
$chk = 'checked';
else
$chk = '';
echo "<input type='checkbox' name='$item' value='1' $chk> $item<br>";
}But, I can't figure out how to check to see if that particular item is in the database... I've pasted the code below and indicated where I'm having a problem.
Code: Select all
$array = array('Milk', 'Eggs', 'Bread', 'Lettuce' , 'Cookies');
$query = "e;SELECT * FROM qtable WHERE id='$did'"e;;
$result = @mysql_query ($query);
while($row=mysql_fetch_array($result)) {
$item=$rowї'items'];
$brd=$rowї'brand'];
$st=$rowї'store'];
}
foreach ($array as $item) {
if ( $item is in database) // THIS IS WHERE I'M STUCK
$chk = 'checked';
else
$chk = '';
echo "e;<input type='checkbox' name='$item' value='1' $chk> $item<br>"e;;
}abase.
But, I can't figure out how to check to see if that particular item is in the database... I've pasted the code below and indicated where I'm having a problem.Code: Select all
$array = array('Milk', 'Eggs', 'Bread', 'Lettuce' , 'Cookies');
$query = "SELECT * FROM qtable WHERE id='$did'";
$result = @mysql_query ($query);
while($row=mysql_fetch_array($result)) {
$item=$row['items'];
$brd=$row['brand'];
$st=$row['store'];
}
foreach ($array as $item) {
if ( $item is in database) // THIS IS WHERE I'M STUCK
$chk = 'checked';
else
$chk = '';
echo "<input type='checkbox' name='$item' value='1' $chk> $item<br>";
}$item=$row['items'];
$brd=$row['brand'];
$st=$row['store'];
}
foreach ($array as $item) {
if ( $item is in database) // THIS IS WHERE I'M STUCK
$chk = 'checked';
else
$chk = '';
echo "<input type='checkbox' name='$item' value='1' $chk> $item<br>";
}
he form editable (that is, a user can select/deselect boxes as they wish) , I've been trying to place "checked" inside the input tag for the values that are actually in the database.
But, I can't figure out how to check to see if that particular item is in the database... I've pasted the code below and indicated where I'm having a problem.
Code: Select all
$array = array('Milk', 'Eggs', 'Bread', 'Lettuce' , 'Cookies');
$query = "e;SELECT * FROM qtable WHERE id='$did'"e;;
$result = @mysql_query ($query);
while($row=mysql_fetch_array($result)) {
$item=$rowї'items'];
$brd=$rowї'brand'];
$st=$rowї'store'];
}
foreach ($array as $item) {
if ( $item is in database) // THIS IS WHERE I'M STUCK
$chk = 'checked';
I've been trying to place "checked" inside the input tag for the values that are actually in the database.
But, I can't figure out how to check to see if that particular item is in the database... I've pasted the code below and indicated where I'm having a problem.Code: Select all
$array = array('Milk', 'Eggs', 'Bread', 'Lettuce' , 'Cookies');
$query = "SELECT * FROM qtable WHERE id='$did'";
$result = @mysql_query ($query);
while($row=mysql_fetch_array($result)) {
$item=$row['items'];
$brd=$row['brand'];
$st=$row['store'];
}
foreach ($array as $item) {
$array = array('Milk', 'Eggs', 'Bread', 'Lettuce' , 'Cookies');
$query = "SELECT * FROM qtable WHERE id='$did'";
$result = @mysql_query ($query);
while($row=mysql_fetch_array($result)) {
$item=$row['items'];
$brd=$row['brand'];
$st=$row['store'];
}
foreach ($array as $item) {
if ( $item is in database) // THIS IS WHERE I'M STUCK
$chk = 'checked';
else
$chk = '';
echo "<input type='checkbox' name='$item' value='1' $chk> $item<br>";
}