Hi I have a form with a checkbox where people can select student’s names that they wish to see their profiles for. The code looks like this:
[code]
<?php do { ?><p>
<input name="UID[]" type="checkbox" id="UID" value="<?php echo $row_applicants['UID']; ?>" />
<label for="UID"></label>
<?php echo $row_applicants['FNAME']; ?> <?php echo $row_applicants['LNAME']; ?> </p>
<?php } while ($row_applicants = mysql_fetch_assoc($applicants)); ?>
[/code]
Once they submit the form, the array is sent to another page which will show all the profiles selected. Here is the code for that page:
[code]
<?php if (!function_exists("GetSQLValueString")) { function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "") { if (PHP_VERSION < 6) { $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue; } $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue); switch ($theType) { case "text": $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL"; break; case "long": case "int": $theValue = ($theValue != "") ? intval($theValue) : "NULL"; break; case "double": $theValue = ($theValue != "") ? doubleval($theValue) : "NULL"; break; case "date": $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL"; break; case "defined": $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue; break; } return $theValue; } $ID = $_POST['ID']; } mysql_select_db($database_connect, $connect); $idList = implode(',', $_POST['UID']); $sql = 'SELECT *, scholarships.NAME as scholarshipname FROM scholarships, gc_codes, users, activities, coll_exp, emply, finaid, fin_app, stu_app2008, stu_special WHERE gc_codes.GCID = users.GC stu_special.ID = $ID and scholarships.ID = stu_special.ID and UID in (' . $idList . ')'; $res = mysql_query($sql); $varlist = array(); while ($row = mysql_fetch_assoc($res)) { $varlist[$row['UID']] = $row; } ?> td img {display: block;} td img {margin: 0;} .break { page-break-before: always; } Cambridge Rindge & Latin School | 2012 Scholarship Standard Application <?php foreach ($varlist as $UID => $row) do { ?>
|