Ejemplo n.º 1
0
if ($_POST['verify']) {
    for ($i = 0; $i < $_POST['count']; $i++) {
        $info = array('fname' => $_POST['fname' . $i], 'lname' => $_POST['lname' . $i], 'email' => $_POST['email' . $i], 'uname' => $_POST['uname' . $i], 'remove' => $_POST['remove' . $i]);
        $students[] = checkUserInfo($info);
        if (!empty($students[$i]['err_email']) || !empty($students[$i]['err_uname'])) {
            $still_errors = TRUE;
        }
    }
    /**************************************************************************/
    // !!!!!!STEP 3 - INSERT INTO DB !!!!!!!
    if (!$still_errors && (isset($_POST['submit_unenr']) || isset($_POST['submit_enr']))) {
        $enroll = 'y';
        if (isset($_POST['submit_unenr'])) {
            $enroll = 'n';
        }
        add_users($students, $enroll, $_SESSION['course_id']);
        ?>
		 <div id="container">
		<form method="post" action="<?php 
        echo $_SERVER['PHP_SELF'];
        ?>
" name="finalform" />
		<div class="input-form">
		<?php 
        $msg->printFeedbacks();
        ?>
			<div class="row buttons">
				<input type="submit" name="addmore" value="<?php 
        echo _AT('add_more');
        ?>
" />
Ejemplo n.º 2
0
			<td>Full Name in Upper Case</td>
			<td>Length of full name <span>(without spaces)</span></td>
		</tr>

		<?php 
$users = array(array('first_name' => 'Michael', 'last_name' => 'Choi'), array('first_name' => 'John', 'last_name' => 'Supsupin'), array('first_name' => 'Mark', 'last_name' => 'Guillen'), array('first_name' => 'KB', 'last_name' => 'Tonel'), array('first_name' => 'Hey', 'last_name' => 'Dude'), array('first_name' => 'Tom', 'last_name' => 'Celek'), array('first_name' => 'Kobe', 'last_name' => 'Bryant'), array('first_name' => 'Steve', 'last_name' => 'Young'), array('first_name' => 'Bob', 'last_name' => 'Ross'), array('first_name' => 'Barry', 'last_name' => 'Bonds'), array('first_name' => 'Andrew', 'last_name' => 'Luck'), array('first_name' => 'John', 'last_name' => 'Steinbeck'), array('first_name' => 'Ansel', 'last_name' => 'Adams'), array('first_name' => 'Barack', 'last_name' => 'Obama'));
function add_users($array)
{
    $i = 0;
    foreach ($array as $key => $user) {
        $i++;
        $fullname = $user['first_name'] . " " . $user['last_name'];
        $nospace = $user['first_name'] . $user['last_name'];
        $content = "<td class='bold'>" . $i . "</td> <td>" . $user['first_name'] . "</td> <td>" . $user['last_name'] . "</td> <td>" . $fullname . "</td> <td>" . strtoupper($fullname) . "</td> <td>" . strlen(trim($nospace)) . "</td> </tr>";
        if ($i % 5 === 0) {
            echo "<tr class='gray'>";
            echo $content;
        } else {
            echo "<tr>";
            echo $content;
        }
    }
}
add_users($users);
?>
	
	</table>

</body>

</html>