lwaters5 Posted January 15, 2013 Share Posted January 15, 2013 (edited) 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 { ?> <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)); ?> <p> <input type="submit" name="button" id="button" value="Submit" /> </p> </form> 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 January 15, 2013 by lwaters5 Quote Link to comment https://forums.phpfreaks.com/topic/273193-print-array-from-checkbox/ Share on other sites More sharing options...
lwaters5 Posted January 15, 2013 Author Share Posted January 15, 2013 (edited) Here is the attachment. Thansk Edited January 15, 2013 by lwaters5 Quote Link to comment https://forums.phpfreaks.com/topic/273193-print-array-from-checkbox/#findComment-1405873 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.