Here's what I'm saying, there is a 3 checkbox that can select 1, 2 or 3. But my code can only get 1 value out of 3 if I'm going to select all 3.
Here's the code:
Form Page 1
<input type="checkbox" name="cb[]" value="1" /> <input type="checkbox" name="cb[]" value="2" /> <input type="checkbox" name="cb[]" value="3" />
PHP Page 2 - this side working accordingly.
<?php
if(isset($_POST['email'])) {
// EDIT THE 2 LINES BELOW AS REQUIRED
$email_to = "sample@gmail.com";
$email_subject = "Sample Application";
$fname = $_POST['fname']; // required
$mname = $_POST['mname']; // required
$lname = $_POST['lname']; // required
$lname = $_POST['cb[]']; // required
function clean_string($string) {
$bad = array("content-type","bcc:","to:","cc:","href");
return str_replace($bad,"",$string);
}
$email_message .= "Name: ".clean_string($fname)." ".clean_string($mname).". " .clean_string($lname)."\n";
$email_message .= "Select ".clean_string($cb[])."\n";[quote]this result got one(1) value only[/quote]
$headers = 'From: '.$email_from."\r\n".
'Reply-To: '.$email_from."\r\n" .
'X-Mailer: PHP/' . phpversion();
@mail($email_to, $email_subject, $email_message, $headers); ;}
?>
I need help in this area.
How can I create an array in this type of code?
Where can I put the array?
I've try this one but I don't know where this code to be place.
$ids = $this->input->get_post('cb');
if(!empty($ids)){
foreach($ids as $id){
// get email id from database or directly give email address to check box value
}
}
I need help in this problem...
thanks
kiad
This post has been edited by kiad_198: 31 August 2011 - 12:12 PM

New Topic/Question
Reply




MultiQuote





|