Re: POST checkbox group



Many Thanks. Easy when you know how!
--
Richard

Michael Fesser wrote:
.oO(Richard Walker)

Trying to send the data from a checkbox group to a php process and it's just sending the last box clicked as a variable, rather than the whole group as an array. Am I being stupid?

ie html:

<form name="selectform" action="data.php" method="post">
<input name="days" type="checkbox" value="mon" />Mon
<input name="days" type="checkbox" value="tue" />Tue
<input name="days" type="checkbox" value="wed" />Wed
<input type="submit" name="Submit" value="Submit" />
</form>

Use name="days[]". Then $_POST['days'] will be an array, containing the
values of all checked checkboxes.

Micha
.



Relevant Pages

  • Re: Multi-part mime ARGHHHHHH!
    ... Michael Fesser wrote: ... I'm trying to create an HTML ... formatted email message with two attachments using PHP's mail. ...
    (comp.lang.php)
  • Re: Multi-part mime ARGHHHHHH!
    ... Michael Fesser wrote: ... I'm trying to create an HTML ... formatted email message with two attachments using PHP's mail. ...
    (comp.lang.php)
  • Re: I was a genius for a while
    ... Michael Fesser wrote: ... Instead there should be .html or no extension at all. ... change the used server technology, for example from a rather simple SSI ...
    (alt.php)
  • Re: What Next?
    ... Michael Fesser wrote: ... as HTML and parsed as HTML. ... But one of the reasons it was developed was to ensure that the web content can be deliverd in a greater number of ways, and to a greater number of clients... ... including and especially, HTML clients. ...
    (comp.lang.php)