Jump to content


taking checkbox information and emailing it


4 replies to this topic

#1 tiki

    Young Padawan

  • Members
  • Pip
  • 259 posts
  • Gender:Male
  • Location:California

Posted 21 March 2006 - 02:43 AM

Im trying to have people select checkboxes and then send the array to my email, but it does not work, heres what I have.

The checkboxes:
<div class="left service"><input type="checkbox" name="service[]" id="web" value="Web Design" /> <label for="web">Web Design</label> </div>
<div class="left service"><input type="checkbox" name="service[]" id="php" value="Php Work" /> <label for="php">Php Design</label> </div>
<br class="clear" />
					
<div class="left service"><input type="checkbox" name="service[]" id="illd" value="Illustration" /> <label for="illd">Illustration</label> </div>
<div class="left service"><input type="checkbox" name="service[]" id="logo" value="Logo &amp; Card Design" /> <label for="logo">Logo Design</label> </div>
<br class="clear" />
					
<div class="left service"><input type="checkbox" name="service[]" id="graphics" value="Graphic Design" /> <label for="graphics">Graphic Design</label> </div>
<div class="left service"><input type="checkbox" name="service[]" id="clothing" value="Clothing Design" /> <label for="clothing">Clothing Design</label> </div>
<br class="clear" />

And the code that should put them together?
$services = "";
	$service  = $HTTP_POST_VARS["service"];
	foreach ($service as $item) {
		$services += $item .', '; }


#2 rc69

    PHP Master PD

  • P2L Staff
  • PipPipPipPip
  • 3,827 posts
  • Gender:Male
  • Location:Here
  • Interests:Web Development

Posted 21 March 2006 - 09:57 PM

$services = '';
highlight_string(print_r($_POST['service'],1));
	foreach ($_POST['service'] as $item){
		$services += $item .', ';
	}
echo '<br>'.$services;
Keep in mind that the use of $HTTP_POST_VARS is depreceated, and in php 5, optionally unavailable.
The above code will out put everything in the $_POST array, then what gets added to $services. Run it, then we can narrow down your problem.

#3 tiki

    Young Padawan

  • Members
  • Pip
  • 259 posts
  • Gender:Male
  • Location:California

Posted 21 March 2006 - 10:22 PM

It always returns 0.

#4 rc69

    PHP Master PD

  • P2L Staff
  • PipPipPipPip
  • 3,827 posts
  • Gender:Male
  • Location:Here
  • Interests:Web Development

Posted 21 March 2006 - 10:25 PM

What's it?

#5 tiki

    Young Padawan

  • Members
  • Pip
  • 259 posts
  • Gender:Male
  • Location:California

Posted 21 March 2006 - 11:01 PM

The services checkboxes, once using mine or your string.





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users