Bike Crash (Surprise) Squirrel!!
(Original image from: http://www.rofl.name/)Nuclear (Surprise) Squirrel!!
(Original image from: http://science.howstuffworks.com/)Surprise Squirrel!! (at least that’s what I call him)
(Source: http://www.telegraph.co.uk/news/newstopics/howaboutthat/6018173/Squirrel-is-surprise-star-of-holiday-photo.html)[video]
Run out of options? No problem, click ‘Another Option?’
This jQuery plugin lets you easily create new fields with the click of a button (granted you are okay with using <table>s.) It’s easy to integrate and fairly customizable.
Appendo courtesy of Deep Liquid
[video]
[video]
For some time I had trouble figuring out how to post checkbox results using jQuery’s $.post function after submitting a form. I searched many different sites finding pieces of the a solution that would fit my needs.
Anyway here’s what I got:
1) Let’s create a simple form.
<form id="my_form" onsubmit="return processForm()">
1) <input type="checkbox" class="option" name="options[]" value="1" /><br />
2) <input type="checkbox" class="option" name="options[]" value="2" /><br />
3) <input type="checkbox" class="option" name="options[]" value="3" /><br />
<input type="submit" value="Submit" />
</form>
2) Create the javascript to handle the form submission.
function processForm() {
var options = $('#my_form :input.option');
var option_array = new Array();
$.each(options, function(index, element) {
if ($(element).is(':checked')) {
option_array.push($(element).val());
}
// Post options to action file
$.post('/your/path/to/action/file.php', {'options[]': option_array});
return false;
}
3) Handle the form submission using PHP.
<?php
foreach ($_POST['options'] as $option) {
/* Do whatever you want with your options here. */
}
// Or you can just print the results to the screen for test purposes
print_r($_POST);
exit;
?>
…never code without it.
Courtesy of Remy Sharp
I am almost proud to present my latest site.
I am very close to wrapping it up, but I think it will be another week of perfecting it and making sure all the screws are tightened.
Here are some screen captures for a teaser:
Login Form (Header)
Register Form
Survey Overview
Voting Booth