Hi, just a lame question, firstly a bit of background; I can code (poorly) newbie ish to PHP, but posting here cos i think my question is within your realm.....
I have a HTML form, that has a whole load of checkboxes, these are drawn from a table in my DB, these checkboxes can increase or decrease, ie there are 'n' amount of check boxes.
include("../ad.inc");
$db = mysql_connect ($host, $username, $password) or die ("Could not connect to the database.");
mysql_select_db ($dbase, $db);
<?php
$event_types=mysql_query("select * from event_type order by display_value");
while ($row = mysql_fetch_array($event_types)) {
?>
<tr>
<td class="spacer" colspan="4"></td>
</tr>
<tr>
<td class="textblackmedbold" colspan="4"><?= $row["Event_Type"] ?> </td>
</tr>
<tr>
<td class="spacer" colspan="4"></td>
</tr>
<tr>
<td class="textblackmed" colspan="4"><?= $row["Free_Text"] ?></td>
</tr>
<tr>
<td class="spacer" colspan="4"></td>
</tr>
<?
$display_value = $row["Display_Value"] ;
$result=mysql_query("select * from events where event_type_id = $display_value");
while ($events = mysql_fetch_array($result))
{
?>
<tr>
<!-- <td><input type = "checkbox" name="<?= $row["Event_Type"]; ?><?= $events["Event_ID"]; ?>" value="<?= $events["Event_ID"] ?>"></td> -->
<td><input type = "checkbox" name="eventid<?= $events["Event_ID"]; ?>" value="<?= $events["Event_ID"] ?>"></td>
<td class="textblackmed" width="10" align="left">£<?= $events["Amount"] ?> </td>
<td class="textblackmed" width="*"><?= $events["Title"] ?> </td>
<td class="textblackmed" width="*"><?= $events["Text"] ?> </td>
<td class="textblackmed" width="90"><?= $events["Date_Running"] ?> </td>
<td class="textblackmed" width="5"><?= $events["Time_Running"] ?> </td>
</tr>
<?
}
?>
<?
}
?>
I want to grab the values on my next page, from these checkboxes, obviously. So far i am trying to create variables, using the same table that creates the checkboxes on the first form.
like this.....
<?php
include("../ad.inc");
$db = mysql_connect ($host, $username, $password) or die ("Could not connect to the database.");
mysql_select_db ($dbase, $db);
$result=mysql_query("select * from events");
while ($events = mysql_fetch_array($result))
{
?>
<? # echo $events['event_id']; ?> <? # Edit ?>
<? $events = $_REQUEST['eventid'. $events['Event_ID']];?>
<?
}
?>
<? echo $events['event_id']; ?> <? # Edit ?>
Does this make sense?
So basically i have an array containg the boolean values from the checkboxes, yeah?
i want to put the values into variables, prob same names(eventid1, eventid2, eventidn)
Just to rub salt in the wounds, i also want to display these values to the user, i can do that by referencing the variables, i just gotta work out how to do it dynamically.....but i'll start running once you guys have, hopefully, helped me to walk.
thanx
ad