Mombu the Php Forum sponsored links

Go Back   Mombu the Php Forum > Php > Little Problem with php Checkboxes
User Name
Password
REGISTER NOW! Mark Forums Read

sponsored links


Reply
 
1 10th June 23:08
arjan
External User
 
Posts: 1
Default Little Problem with php Checkboxes



Hello,
First i want to tell i'm a newbie with php.
I have a little problem and that's the following. My checkboxes are working,
but when i will use the mailer, only the last checked checkbox will send to
mail.
The others not.

I read on the internet that i must give it an ID. But i don't know how. And
how must i change my mailer.php and config.php.

What i want is the following.
First there is a question how the people want to stay at our camping.
Then there is a question of they will move with there camper or something.

When i fill in the full form, then te form will be send to me.
In the mail there is only the latest checkbox from te second question.

I hope that someone can help me.
Greetings


I will send a sample of the scripts.

**** QUESTION FORM ****
<td>Wij willen graag een kampeerplaats reserveren voor een: </td>
<td>
<input type="checkbox" name="check[]" value="tent"> Tent <input
type="checkbox"name="check[]" value="vouwwagen">Vouwwagen
<input type="checkbox" name="check[]" value="caravan"> Caravan <input
type="checkbox"name="check[]" value="camper"> Camper
<td></td>
</td>
</tr>
<td>Wij willen graag een overnachtingsplaats reserver voor:
(deze plaatsen zijn voor gasten die overdag met hun kampeermiddel willen
uitrijden?)
</td>
<td>
<input type="checkbox" name="check[]" value="caravan uitrijden"> Caravan
uitrijden <input type="checkbox" name="check[]" value="Camper uitrijden">
camper uitrijden

*** MAILER FORM*****
foreach($_POST['check'] as $value);

*** CONFIG FORM *****
$message .= "Kampeermiddel:".$value." \n";
  Reply With Quote


  sponsored links


2 10th June 23:09
simon
External User
 
Posts: 1
Default Little Problem with php Checkboxes



You need to make each name unique
<input type="checkbox" name="tent" value="tent"> Tent <input
  Reply With Quote
3 10th June 23:09
arjan
External User
 
Posts: 1
Default Little Problem with php Checkboxes


But what must i do with the config.php and the mailer.php
See below?
Someone??

"Simon" <simon@webworx.co.uk> schreef in bericht
news:k7JPf.74056$494.24493@newsfe2-gui.ntli.net...
  Reply With Quote
4 11th June 01:38
rwagener11
External User
 
Posts: 1
Default Little Problem with php Checkboxes


I don't think Simon understood what you are doing. I would leave the
check[] name the same. But change the foreach handler. Also, I have
never used the foreach command in the same manner as described above.

change the foreach command to the following:

<?

foreach($_POST['check'] as $k => $v) { $value .= " $v "; }

?>

Hope this helps
  Reply With Quote


  sponsored links


Reply


Thread Tools
Display Modes




Copyright © 2006 SmartyDevil.com - Dies Mies Jeschet Boenedoesef Douvema Enitemaus -
666