Re: php form mail - checkbox problem
| From: | Marek Kilimajer | Date: | Wed, 30 Oct 2002 12:24:40 +0000 |
| Subject: | Re: php form mail - checkbox problem | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-122010@lists.php.net to get a copy of this message | ||
Tine wrote:
Greetings, Forgive my newbism here, but I am having a hard time recieving check(box)ed items from a form sent to e-mail using PHP. The code is as follows: //Routine for checkboxes$_REQUEST[medlemskap][$i] instead. It might be also simpler to use foreach($_REQUEST['medlemskap'] as $v) { $MailBody .= "$v, "; }$MailBody .="Type medlemskap : ";$items = 2; //initiate possible # of items for ($i = 1; $i <= $items; $i++) { //loop on # of items$MailBody .= "$medlemskap[$i], "; //put results in variable MailBodywhere is $medlemskap set? is it comming from the form? you might then need to use
} ..and the html code put in the form is: <input type="checkbox" name="item_1[]" value="hovedmedlemskap"> hovedmedlemskap [200 kr.] <input type="checkbox" name="item_2[]" value="2 i husholdning"> 2 eller flere i samme husholdning [100 kr.] why are you using two different names for variables (item_1 and item_2)? should not it bename="medlemskap[]"
The problem is, when I recieve the form as email, it just shows the checked item(s) as: ",," (without the quotemarks) What am I doing wrong? I am using the script found here: http://www.grenadine.net/php/NadForm/NadForm_en.html Website where my form is located is here: http://komposlo.inmono.net/m_skap.html Help is very much appreciated! Thanks in advance, Tine