View Single Post
  #14  
Chojin Chojin is offline
was never good
Chojin's Avatar
Join Date: Apr 1999
Chojin won the popularity contestChojin won the popularity contestChojin won the popularity contestChojin won the popularity contestChojin won the popularity contestChojin won the popularity contestChojin won the popularity contestChojin won the popularity contestChojin won the popularity contest
Old Jan 20th, 2007, 04:06 PM       
Okay I'm starting to get a better hang of PHP and MySQL.

I now have a lil form that I made where I fill out information:



And it outputs to an archive file:



Most of these don't have 'description' information, so that's why that's missing. But the error there is from when I try to output the 'Favorite' information. On the input form, the favorite is defined like so:

Code:
<label for="favorite">Favorite Kitty?</label></td><td><input type="checkbox" value="favorite" name="favorite[]" id="favorite" />
and previous to that in the same file, (excerpted)

Code:
$favorite = htmlspecialchars(strip_tags($_POST['favorite']));
...
$sql = "INSERT INTO wiikitty_archive (timestamp,catname,location,catfilename,favorite,description) VALUES ('$timestamp','$catname','$location','$catfilename','$favorite','$description')";
and finally in the result file:

Code:
<?php foreach ($favorite as $f) {echo $f;} ?>
and that produces the above error. When I change that last bit of code to:

Code:
<?php echo $favorite; ?>
then I get this:



Where it just says 'Array' on the favorited WiiKitties. ("First submitted WiiKitty" is the description info)

So, how do I make it show the checkbox information?

Also, due to an oversight on my part, it wasn't adding the favorite information until that cat in the upper left. How would I go into the database manually to add that? Or to fix anything, really? I have phpMyadmin.
Reply With Quote