PDA

View Full Version : php code for check boxes


richcodesign
01-12-2010, 01:23 PM
Hello,

I have 'borrowed' the code from a post in this forum for submitting details entered into a form to an email.

The form is working great but i want to add in check buttons.
I only want the selected check buttons to show up on the email.
You can see from the attached file that it shows all of them and also the two that were selected (in this case $10 and $18 were selected)

http://www.oakislandharbor.com/form_test2.php

any help or comments on code would be appreciated:-D

davidj
01-12-2010, 03:25 PM
As we all know $_POST is an array of posted form elements and values

So just unset all the empty ones before you compose your email


foreach($_POST as $key => $value) {

if (is_null($value)) {

unset($_POST[$key]);

}

}

You will be left with an array ($_POST) which only contains keys with a value assigned

richcodesign
01-29-2010, 01:30 PM
thanks for the code, but i really need it to be dumbed down a little???!!!

Im not sure where the code needs to be placed.

The link is now:

http://www.oakislandharbor.com/advertising.php

The form is toward the bottom of the page.

The image attached shows the email that i get once the form has been completed

davidj
01-29-2010, 05:56 PM
Have you ever fancied learning what its all about?

It gives you wings!

richcodesign
02-02-2010, 01:27 PM
Hi David,

You taught me the basics about 6 months ago - Tamara here.

I think that i have done well so far, but its been some time since training and practice that some things have slipped my mind.

I may actually get your help again setting up this and another form that i have to create.

I asked the forum for advise on the best way to create email forms and they all suggested PHP

davidj
02-02-2010, 01:46 PM
contact me through Skype

gigiloumill
02-08-2010, 12:49 AM
Can you choose more than one package at a time? If not, then you're probably better off with a drop down menu...