</option> <?php } } ?> </select> <?php } ?> </div> <div class="col-sm-6"> <label for="selectPhoneCarrier">Phone Carrier</label> <select id="selectPhoneCarrier" name="cell_phone_carrier_id" class="form-control"> <option value="">Select a carrier...</option> <?php $phone_carriers = CellPhoneCarrier::loadAll(); if (!empty($phone_carriers)) { foreach ($phone_carriers as $phone_carrier) { $selected = ''; if ($user->getCellPhoneCarrierId() == $phone_carrier->getId()) { $selected = 'selected="selected"'; } ?> <option value="<?php echo $phone_carrier->getId(); ?> " <?php echo $selected; ?> > <?php
echo $currentUser->getEmailAddress(); ?> " placeholder="Email" required> <label for="inputCell" class="sr-only">Cell Phone</label> <input type="text" id="inputCell" class="form-control" value="<?php echo $currentUser->getPhoneNumber(); ?> " placeholder="Phone Number" required> <label for="inputCellCarrier">Cell Phone Carrier</label> <select name="inputCellCarrier" id="inputCellCarrier" class="form-control"> <option value="">Cell Phone Carrier</option> <?php $cellPhoneCarriers = CellPhoneCarrier::loadAll(); foreach ($cellPhoneCarriers as $cellPhoneCarrier) { $selected = ''; if ($currentUser->getCellPhoneCarrierId() == $cellPhoneCarrier->getId()) { $selected = 'selected="selected"'; } echo "<option value=" . $cellPhoneCarrier->getId() . " {$selected}>" . $cellPhoneCarrier->getName() . "</option>"; } ?> </select> <h3>Password</h3> <p>Leave this group blank to keep existing password. </p> <label for="inputPassword" class="sr-only">Password</label> <input type="password" id="inputPassword" class="form-control" placeholder="Password"> <label for="inputPasswordConfirm" class="sr-only">Password</label>
$cell = str_replace('-', '', $cell); //replace dashes from phone number $cell = str_replace('(', '', $cell); //replace open paren from phone number $cell = str_replace(')', '', $cell); //replace close paren from phone number $cell = str_replace(' ', '', $cell); //replace spaces from phone number } $cell_phone_carrier_id = $_POST['cell_carrier']; $cell_phone_carrier = NULL; if (empty($_POST['cell_carrier'])) { $response['error'][] = 'Cell Phone Carrier is required'; } else { $cell_phone_carrier_id = $_POST['cell_carrier']; $cell_phone_carrier = CellPhoneCarrier::loadById($cell_phone_carrier_id); } if (empty($_POST['password'])) { $response['error'][] = 'Password is required'; } if (empty($_POST['password_confirm'])) { $response['error'][] = 'Confirm Password is required'; } if ($_POST['password'] != $_POST['password_confirm']) { $response['error'][] = 'Passwords do not match'; } if (empty($response['error'])) { $user = new User(array('first_name' => $_POST['first_name'], 'last_name' => $_POST['last_name'], 'email_address' => $_POST['email_address'], 'phone_number' => $cell, 'cell_phone_carrier_id' => $_POST['cell_carrier'], 'password' => $_POST['password'], 'password_again' => $_POST['password_confirm'], 'type_id' => 1)); if ($user->add()) { $response['success'] = true; // email and text a welcome message