Jump to content

Print Array from Checkbox


Recommended Posts

HI, I am a newbie using Dreamweaver to create a form that has a checbox next to students's names. Once you select the student's you wish to see, you hit submit and it sends you to anther page where it displays the profiles for each of these students so they can be printed. My form looks like this:


<form id="form1" name="form1" method="post" action="test4.php">

<?php do { ?>


<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)); ?>


<input type="submit" name="button" id="button" value="Submit" />




My test results page looks like this:


mysql_connect ( $dbhost, $dbuser, $dbpass)or die("Could not connect: ".mysql_error());
mysql_select_db($dbname) or die(mysql_error());

$UID = $_POST['UID'];
$query = "SELECT * FROM users WHERE UID = ('$UID')";
$results = mysql_query($query) or die(mysql_error());
if(mysql_num_rows($results)==1){ // If there is only one row that was returned
$results = mysql_fetch_array($results);
echo $results['UID']; // If the column name is incorrect, just change it to match
}elseif(mysql_num_rows($results)>1){ // If there is more than one row that was returned
while($result=mysql_fetch_array($results)){ // Loop through each row that was returned and display it
echo $result['UID']."
}else{ //If there were no rows returned, this is just to account for every option and is entirely optional
echo "No matched!";


I want the end result page to look like the attached file with multiple profiles.


Thanks in advance

Edited by lwaters5
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.