Hye people, would appreciate your ideas on following:
(will try to keep it short)
I made a form in a php file. It posts it's value with the 'mail function' in an include file to my email address.
There's only one part, I just don't seem to get right.
In the form I use a variable that is generated from the input it gets from it's DB, like this:
<?
$sql = "SELECT adres, plaats FROM ".$TABLE["aanbod"]." ORDER BY id";
$result = db_query($sql); $i=0;
while($row = db_fetch_array($result))
{
$i++;
$adres = $row['adres'];
$plaats = $row['plaats'];
echo "<input name= woningen[$i] type=\"checkbox\"value=\"$adres, $plaats\">$adres, $plaats<br>\n";
}
$aantal_select=$i
?>
So what it does is, it places a checkbox for each result it gets from the DB value of the checkbox is 'woningen' but it adds 1 for each new item. (for example, woningen1, woningen2, woningen3, etc.)
This works fine.
After submitting the form I can echo the values of woningen[$i] without a problem, by using following code:
<?
$sql = "SELECT adres, plaats FROM ".$TABLE["aanbod"]." ORDER BY id";
$result = db_query($sql); $i=0;
while($row = db_fetch_array($result))
{
$i++;
$adres = $row['adres'];
$plaats = $row['plaats'];
$woning = $woningen[$i];
echo $woning."\n";
}
?>
This also works correct.
But in the mail function I just don't know how to post the value to my email address. (probably my dumb ignorance) my code in the mail function looks like below:
(also added another variable $naam as a normal inputfield, $naam works just fine, cause it's not dynamic)
<?
$sql = "SELECT adres, plaats FROM ".$TABLE["aanbod"]." ORDER BY id";
$result = db_query($sql);
$i=0;
while($row = db_fetch_array($result))
{
$i++;
$adres = $row['adres'];
$plaats = $row['plaats'];
$woning = $woningen[$i];
//echo $woning."\n"; (if I want to print the result on top of the page, works fine, it shows all values I checked!)
}
$woning = $_POST["?"]; //Dont know what to put between the '[ ]' tags?
$naam = $_POST["naam"]; // This works just fine
/* sends all variables with '$_POST' to an include file */
include_once ("includes/send_email.php");
mail($ontvanger, $onderwerp, $inhoud, $headers);
?>
So main question= how to post the 'increasing' value of $woning?
TNX in advance;
regards siebke
get value into mail function?
Moderator: General Moderators