Forum Moderators: coopster
[size=1]
<?php
require "Include/Config.php";
require "Include/Functions.php";
require "Include/Header.php";
$sPageTitle = gettext("Church Event Editor");
// --------- initializing variables ------------
$sAction = $_POST['Action'];
$EventID = $_POST['EID'];
$per_ID = $_POST['PerID'];
$EvtName = $_POST['EName'];
$EvtDesc = $_POST['EDesc'];
$EvtDate = $_POST['EDate'];
//----------- process the action inputs to delete an attendee ---------
if ($sAction=='Drop'){
$dpeEventID=$_POST['DelPerEventID'];
$dpePerID=$_POST['DelPerID'];
$dpeSQL = "DELETE FROM event_attend
WHERE event_id=$dpeEventID && person_id=$dpePerID LIMIT 1";
RunQuery($dpeSQL);
$ShowAttendees = 1;
// ---------- construct the attendance form and submit button--------------
}?>
<form method="post" action="EditEventAttendees.php" name="AttendeeEditor">
<input type="hidden" name="EID" value="<?php echo $EventID ; ?>">
<table cellpadding="0" cellspacing="0" width="80%" align="center">
<caption>
<h3><?php echo gettext("Attendees for $EvtName"); ?></h3>
</caption>
<tr ><td colspan="5">
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tr>
<td align="center"><span class="SmallText"><?php echo gettext("<strong>Description:</strong> <br>$EvtDesc") ?></span></td>
<td align="center"><span class="SmallText"><?php echo gettext("<strong>Date:</strong><br>$EvtDate") ?></span></td>
</tr>
</table>
</td>
</tr>
<tr><td colspan="5"></td></tr>
<tr>
<td colspan="6" align="right"><input type="submit" align="right" style="font-size: 12px;" name="submit" value="Record Attendance"></td><br>
</tr>
<tr><td colspan="6"></td></tr>
<tr class="TableHeader">
<td width="2%" style="padding-left:5px"><strong><?php echo gettext("Status"); ?></strong></td>
<td width="2%" style="padding-left:5px"><strong><?php echo gettext("ID#"); ?></strong></td>
<td width="15%" style="padding-left:10px"><strong><?php echo gettext("Name"); ?></strong></td>
<td width="15%" style="padding-left:10px"><strong><?php echo gettext("Email"); ?></strong></td>
<td width="15%" style="padding-left:10px"><strong><?php echo gettext("Home Phone"); ?></strong></td>
<td width="20%" align="right" style="padding-right:50px"><strong><?php echo gettext("Attendee Count"); ?></strong></td>
</tr>
<?php // ----------- query attendance information from database --------------
$sSQL = "SELECT * FROM event_attend WHERE event_id=$EventID ORDER BY person_id";
$rsOpps = RunQuery($sSQL);
$numAttRows = mysql_num_rows($rsOpps);
if($numAttRows!=0){
$sRowClass = "RowColorA";
for($na=0; $na<$numAttRows; $na++){
$attRow = mysql_fetch_array($rsOpps, MYSQL_BOTH);
extract($attRow);
$sSQL = "SELECT * FROM person_per WHERE per_ID = $person_id";
$perOpps = RunQuery($sSQL);
$perRow = mysql_fetch_array($perOpps, MYSQL_BOTH);
extract($perRow);
$sRowClass = AlternateRowStyle($sRowClass);
$aHomePhone = ExpandPhoneNumber($per_HomePhone,$per_Country,$dummy);
// ---------- process radio button results -----------------
$Present = $_POST['Present'];
$Absent = $_POST['Absent'];
$checked = $_POST['attendee'];
$Present = 'unchecked';
$Absent = 'unchecked';
if (isset($_POST['submit'])) {
if ($checked == 'Present');
$Present = 'checked';
}else if ($checked == 'Absent'); {
$Absent = 'checked';
foreach ($checked as $value);
echo $checked. " - " .$per_FirstName." " .$per_LastName; ?>  <?php
}
// ---------- fill in the attendee form information and inputs -----------
?>
<tr class="<?php echo $sRowClass; ?>">
<td class="TextColumn"><?php echo ($checked); ?></td>
<td class="TextColumn"><?php echo ($per_ID); ?></td>
<td class="TextColumn"><?php echo FormatFullName($per_Title,$per_FirstName,$per_MiddleName,$per_LastName,$per_Suffix,3); ?></td>
<td class="TextColumn"><?php echo ($per_Email ? '<a href="mailto:'.$per_Email.'" title="Send Email">'.$per_Email.'</a>':'Not Available'); ?></td>
<td class="TextColumn"><?php echo ($aHomePhone ? $aHomePhone :'Not Available'); ?></td>
<td class="TextColumn" colspan="3" align="right">
<form method="POST" action="EditEventAttendees.php" name="Attendance">
<input type="hidden" name="DelPerID" value="<?php echo $per_ID; ?>">
<input type="hidden" name="DelPerEventID" value="<?php echo $EventID; ?>">
<input type="hidden" name="EID" value="<?php echo $EventID; ?>">
<input type="hidden" name="EName" value="<?php echo $EvtName; ?>">
<input type="hidden" name="EDesc" value="<?php echo $EvtDesc; ?>">
<input type="hidden" name="EDate" value="<?php echo $EvtDate; ?>">
<input type="hidden" name="attendee" value="<?php echo ($_POST['row_ID']); ?>">
<label><input type="radio" name="attendee" value="Present<?php echo($_POST['Present']); ?>" checked="checked">Present</label>
<label><input type="radio" name="attendee" value="Absent<?php echo($_POST['Absent']); ?>">Absent  </label>
<input type="submit" style="font-size: 9px;" name="Action" value="<?php echo gettext("Drop"); ?>" onClick="return confirm('Are you sure you want to DELETE <?php echo $per_FirstName." " .$per_LastName; ?> from <?php echo $EvtName; ?>?')">
</form>
</td>
</tr>
<?php
}
} else {
?>
<tr><td colspan="4" align="center"><?php echo gettext("No Attendees Assigned to Event") ?></td></tr>
<?php
}
?>
</table>
<?php require "Include/Footer.php"; ?>
[/size]
<?php
if(isset($_POST['submit_form'])){
for($i = 1; $i < 10; $i ++){
echo "<p>Selected is ".$_POST['radio_but_'.$i]."</p>";
}
}
?>
<form action="radion.php" method="post">
<?php
for($i = 1; $i < 10; $i ++){
echo "<p>1 <input type=\"radio\" name=\"radio_but_$i\" value=\"1\" /> ";
echo "2 <input type=\"radio\" name=\"radio_but_$i\" value=\"2\" /></p>";
}
?>
<p><input type="submit" name="submit_form" value="submit" /></p>
</form>
$q = mysql_query("select first_name from user order by first_name");
$c = mysql_num_rows($q);
if(isset($_POST['my_form'])){
for($j = 0; j < $c; j++){
echo "selected is ".$_POST['att_'.$j];
}
}
$i = 0;
<form name="attendance" method="post">
while($r = @mysql_fetch_array($q)){
Present<input type="radio" name="att_$i" value="present" />
absent<input type="radio" name="att_$i" value="absent" />
$i++;
}
<input type="submit" name="my_form" value="submit" />
</form>