I think i see the problem.
but the solution depends on the db schema:
Please not that neither of these is tested and both use the email address of
the person as a unique id(i am assuming that $recipient is a field of the
form containing the users email. otherwise there sould be some other unique
id). that way you can identify what a specific user requested.
//ex 1:
testing
-------
email
tools
//using the same form
<?php
$count=count($Tools);
$recipient = "[EMAIL PROTECTED]";
$subject = "Test Form Entry";
$headers= "From: [EMAIL PROTECTED]\n";
mail($recipient, $subject, $msg, $headers);
$browser_os = $HTTP_USER_AGENT;
$IP = $REMOTE_ADDR;
$timedate = date("YmdgiA");
$result = @mysql_pconnect("localhost", "root", "test")
or die("There was an error in connecting to the database");
mysql_select_db("test")
or die("There was an error in connecting to the database");
for ($i=0; $i<$count; $i++) {
$msg="What types of tools are you interested in: $Tools[$i]";
$query = "insert into testing (email, tools) values('" .$recipient.
"', '" .$Tools[$i]. "')";
$result = mysql_query($query);
}
?>
----------------------------------------------------------------------------
-----------------------------
//ex2:
testing
-------
email
tool1
tool2
tool3
tool4
tool5
//using the same form
<?php
$count=count($Tools);
for ($i=0; $i<$count; $i++) {
// echo $Tools[$i];
$msg="What types of tools are you interested in: $Tools[$i]";
}
$recipient = "[EMAIL PROTECTED]";
$subject = "Test Form Entry";
$headers= "From: [EMAIL PROTECTED]\n";
mail($recipient, $subject, $msg, $headers);
$browser_os = $HTTP_USER_AGENT;
$IP = $REMOTE_ADDR;
$timedate = date("YmdgiA");
$result = @mysql_pconnect("localhost", "root", "test")
or die("There was an error in connecting to the database");
mysql_select_db("test")
or die("There was an error in connecting to the database");
$query = "insert into testing(email, tool1, tool2, tool3, tool4, tool5)
values('" .$recipient. "','" .$Tools[0]. "', '" .$Tools[1]. "', '"
.$Tools[2]. "', '" .$Tools[3]. "', '" .$Tools[4]. "')";
$result = mysql_query($query);
?>
----------------------------------------------------------------------------
--------------
Robert W. Collins II
Webmaster
New Orleans Regional Transit Authority
Phone : (504) 248-3826
Fax: (504) 248-3866
Email : [EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]>
-----Original Message-----
From: Stephanie Piet [mailto:[EMAIL PROTECTED]]
Sent: Thursday, August 15, 2002 2:34 PM
To: Collins, Robert
Subject: Re: [PHP-WIN] Checkbox/Database Issues
Sure, the top half is part of checkbox area I was talking about. The bottom
portion is the part that sends the e-mail with the form info and stores it
into the DB. Let me know if you need anything else on this, thanks a bunch
:-)
<tr>
<td class="subbody">
<b>What types of tools are you interested in? (Check all that apply)</b>
<br>
<input type="checkbox" name="Tools[]" id="Tools[]" value="Incident Command
Software">Incident Command Software<br>
<input type="checkbox" name="Tools[]" id="Tools[]" value="Contamination Area
Estimator">Contamination Area Estimator<br>
<input type="checkbox" name="Tools[]" id="Tools[]" value="Rapid Hazmat /
Agent Identification">Rapid Hazmat / Agent Identification<br>
<input type="checkbox" name="Tools[]" id="Tools[]" value="Hazmat Detector
Placement Planning & Sampling">Hazmat Detector Placement Planning &
Sampling<br>
<input type="checkbox" name="Tools[]" id="Tools[]" value="PPE Decision
aid">PPE Decision Aid<br>
</td>
</tr>
____________________________________________________________
<?php
$count=count($Tools);
for ($i=0; $i<$count; $i++) {
// echo $Tools[$i];
$msg="What types of tools are you interested in: $Tools[$i]";
}
$recipient = "[EMAIL PROTECTED]";
$subject = "Test Form Entry";
$headers= "From: [EMAIL PROTECTED]\n";
mail($recipient, $subject, $msg, $headers);
$browser_os = $HTTP_USER_AGENT;
$IP = $REMOTE_ADDR;
$timedate = date("YmdgiA");
$result = @mysql_pconnect("localhost", "root", "test")
or die("There was an error in connecting to the database");
mysql_select_db("test")
or die("There was an error in connecting to the database");
$query = "insert into testing(Tools)
values('" .$Tools[$i]. "')";
$result = mysql_query($query);
?>
----- Original Message -----
From: "Collins, Robert" <[EMAIL PROTECTED]>
To: "'Stephanie'" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>
Sent: Thursday, August 15, 2002 3:26 PM
Subject: RE: [PHP-WIN] Checkbox/Database Issues
> Stephanie,
>
> can you give an example of your form and the code used to submit it to the
> Db?
>
> Robert W. Collins II
> Webmaster
> New Orleans Regional Transit Authority
> Phone : (504) 248-3826
> Fax: (504) 248-3866
> Email : [EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]>
>
>
>
> -----Original Message-----
> From: Stephanie [mailto:[EMAIL PROTECTED]]
> Sent: Thursday, August 15, 2002 2:15 PM
> To: [EMAIL PROTECTED]
> Subject: [PHP-WIN] Checkbox/Database Issues
>
>
> Here's my problem: I have a form in which there is a question and 5
> checkboxes to select from (ex: you can select more than one checkbox)
>
> I need to get each checkbox that is selected to show up when it is inputed
> into the mySQL DB.
>
> I can get the first selected checkbox in, but nothing I've done seems to
> work.
>
> Any help would be much appreciated :-)
>
> Stephanie
>
>
>
>
>
> --
> **********************
> Stephanie K. Piet
> OptiMetrics, Inc.
> 2107 Laurel Bush Rd. Suite 209
> Bel Air, MD 21015
> [EMAIL PROTECTED]
> http://www.OptiMetrics.org
> (410)569-6081 ext: 111
> fax: (410)569-6083
>
>
>
> --
> PHP Windows Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
--
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php