Hi Matt,
On Thursday 05 May 2005 13:52, Matthew Macdonald-Wallace wrote:
> I'm writing a recipes collection database so I can just select the
> recipes I want and print off my shopping list! :)
>
> My problem is that I have a generated list of recipes with checkboxes
> next to them, that I want to be able to add to the shopping list when
> selected.
>
> I want to add multiple recipes, but I'm not sure how to do this. I've
> seen it done with Database records in phpMyAdmin etc, but I can't
> workout how to do it myself.
>
> All help/pointers/other info appreciated,
An easy way:
When you output the checkboxes, make the output something like:
<input type="checkbox" name="Recipe[]" value="Chicken" />
<input type="checkbox" name="Recipe[]" value="Beef" />
<input type="checkbox" name="Recipe[]" value="Turkey" />
<input type="checkbox" name="Recipe[]" value="Cat" />
Using the name as 'Recipe[]' means that when the results are submitted back to
your PHP script, it'll become an array, so you can then just do something
like:
foreach ($_POST['Recipe'] as $recipe)
{
print "I want to cook $recipe\n";
}
... that ought to get you going in the right direction!
Cheers
Dave P
____ � The WDVL Discussion List from WDVL.COM � ____
To Join wdvltalk, Send An Email To: mailto:[EMAIL PROTECTED] or
use the web interface http://e-newsletters.internet.com/discussionlists.html/
Send Your Posts To: [email protected]
To change subscription settings, add a password or view the web interface:
http://intm-dl.sparklist.com/read/?forum=wdvltalk
________________ http://www.wdvl.com _______________________
You are currently subscribed to wdvltalk as: [email protected]
To unsubscribe send a blank email to [EMAIL PROTECTED]
To unsubscribe via postal mail, please contact us at:
Jupitermedia Corp.
Attn: Discussion List Management
475 Park Avenue South
New York, NY 10016
Please include the email address which you have been contacted with.