function displayForm($camposPendientes) { if ($camposPendientes) { $error = '<p class="error">Hubo algunos problemas con el formulario que usted presentó. Por favor, complete correctamente los campos remarcados de abajo y haga clic en Enviar para volver a enviar el formulario.</p>'; } else { $error = '<p>por favor, rellene sus datos a continuación y haga clic en Enviar. Los campos marcados con un asterisco (*) son obligatorios.</p>'; } $resultados = array("error" => $error, "scriptUrl" => "index.php", "validacionNombreUsuario" => validateField("nombreUsuario", $camposPendientes), "valorNombreUsuario" => setValue("nombreUsuario"), "validacionApellidos" => validateField("apellidos", $camposPendientes), "valorApellidos" => setValue("apellidos"), "tipoMusicaRock" => setSelected("tipoMusica", "Rock"), "tipoMusicaPop" => setSelected("tipoMusica", "Pop"), "tipoMusicaRegee" => setSelected("tipoMusica", "Regee"), "tipoMusicaClasica" => setSelected("tipoMusica", "Clasica"), "tipoLibrosNovelaNegra" => setChecked("tipoLibros", "Novela Negra"), "tipoLibrosCienciaFiccion" => setChecked("tipoLibros", "Ciencia Ficcion"), "tipoLibrosFantasia" => setChecked("tipoLibros", "Fantasia")); $plantilla = "plantillas/encuestaForm.html"; $formulario = vista($resultados, $plantilla); $datos = array("titulo" => TITULO, "formulario" => $formulario); $plantilla = "plantillas/plantilla.html"; $html = vista($datos, $plantilla); print $html; }
function displayForm($missingFields) { $results = array("pageTitle" => "Membership Form", "scriptUrl" => "registration.php", "missingFields" => $missingFields, "firstNameAttrs" => validateField("firstName", $missingFields), "firstNameValue" => setValue("firstName"), "lastNameAttrs" => validateField("lastName", $missingFields), "lastNameValue" => setValue("lastName"), "genderAttrs" => validateField("gender", $missingFields), "genderMChecked" => setChecked("gender", "M"), "genderFChecked" => setChecked("gender", "F"), "favoriteWidgetOptions" => array("superWidget" => setSelected("favoriteWidget", "superWidget"), "megaWidget" => setSelected("favoriteWidget", "megaWidget"), "wonderWidget" => setSelected("favoriteWidget", "wonderWidget")), "newsletterChecked" => setChecked("newsletter", "yes"), "commentsValue" => setValue("comments")); require "templates/registration_form.php"; }
setChecked($formdata, 'games', 'fallout4'); ?> /> <label for="fallout4">Fallout4</label> <input type="checkbox" id="justcause3" name="games[]" value="justcause3" <?php setChecked($formdata, 'games', 'justcause3'); ?> /> <label for="justcause3">JustCause3</label> <input type="checkbox" id="mgsv" name="games[]" value="mgsv" <?php setChecked($formdata, 'games', 'mgsv'); ?> /> <label for="mgsv">MGSV</label> </div> <div class="errors"> <span id="gamesError"> <?php if (isset($errors['games'])) { echo $errors['games']; } ?> </span> </div> </div>
function displayForm($missingFields) { ?> <h1>Membership Form</h1> <?php if ($missingFields) { ?> <p class="error">There were some problems with the form you submitted. Please complete the fields highlighted below and click Send Details to resend the form.</p> <?php } else { ?> <p>Thanks for choosing to join The Widget Club. To register, please fill in your details below and click Send Details. Fields marked with an asterisk (*) are required.</p> <?php } ?> <form action="registration.php" method="post"> <div style="width: 30em;"> <label for="firstName"<?php validateField("firstName", $missingFields); ?> >First name *</label> <input type="text" name="firstName" id="firstName" value="<?php setValue("firstName"); ?> " /> <label for="lastName"<?php validateField("lastName", $missingFields); ?> >Last name *</label> <input type="text" name="lastName" id="lastName" value="<?php setValue("lastName"); ?> " /> <label for="password1"<?php if ($missingFields) { echo ' class="error"'; } ?> >Choose a password *</label> <input type="password" name="password1" id="password1" value="" /> <label for="password2"<?php if ($missingFields) { echo ' class="error"'; } ?> >Retype password *</label> <input type="password" name="password2" id="password2" value="" /> <label<?php validateField("gender", $missingFields); ?> >Your gender: *</label> <label for="genderMale">Male</label> <input type="radio" name="gender" id="genderMale" value="M"<?php setChecked("gender", "M"); ?> /> <label for="genderFemale">Female</label> <input type="radio" name="gender" id="genderFemale" value="F"<?php setChecked("gender", "F"); ?> /> <label for="favoriteWidget">What's your favorite widget? *</label> <select name="favoriteWidget" id="favoriteWidget" size="1"> <option value="superWidget"<?php setSelected("favoriteWidget", "superWidget"); ?> >The SuperWidget</option> <option value="megaWidget"<?php setSelected("favoriteWidget", "megaWidget"); ?> >The MegaWidget</option> <option value="wonderWidget"<?php setSelected("favoriteWidget", "wonderWidget"); ?> >The WonderWidget</option> </select> <label for="newsletter">Do you want to receive our newsletter?</label> <input type="checkbox" name="newsletter" id="newsletter" value="yes"<?php setChecked("newsletter", "yes"); ?> /> <label for="comments">Any comments?</label> <textarea name="comments" id="comments" rows="4" cols="50"><?php setValue("comments"); ?> </textarea> <div style="clear: both;"> <input type="submit" name="submitButton" id="submitButton" value="Send Details" /> <input type="reset" name="resetButton" id="resetButton" value="Reset Form" style="margin-right: 20px;" /> </div> </div> </form> <?php }
function displaypaso2() { $datos = array("nombre" => setValue("nombre"), "apellidos" => setValue("apellidos"), "direccion" => setValue("direccion"), "telefono" => setValue("telefono"), "email" => setValue("email"), "foto" => $_FILES["foto"]["name"], "ciudadesRoma" => setSelected("ciudades", "Roma"), "ciudadesParis" => setSelected("ciudades", "Paris"), "ciudadesNueva York" => setSelected("ciudades", "Nueva York"), "ciudadesLondres" => setSelected("ciudades", "Londres"), "ciudadesBerlin" => setSelected("ciudades", "Berlin"), "ciudadesAtenas" => setSelected("ciudades", "Atenas"), "informacionCorreoPostal" => setChecked("informacion", "Correo Postal"), "informacionEmail" => setChecked("informacion", "Email")); $plantilla = "plantillas/paso2.html"; $formulario = vista($datos, $plantilla); $datos = array("titulo" => TITULO, "formulario" => $formulario); $plantilla = "plantillas/plantilla.html"; $html = vista($datos, $plantilla); print $html; }
function displayStep3() { ?> <h1>Member Signup: Step 3</h1> <form action="registration_multistep.php" method="post"> <div style="width: 30em;"> <input type="hidden" name="step" value="3" /> <input type="hidden" name="firstName" value="<?php setValue("firstName"); ?> " /> <input type="hidden" name="lastName" value="<?php setValue("lastName"); ?> " /> <input type="hidden" name="gender" value="<?php setValue("gender"); ?> " /> <input type="hidden" name="favoriteWidget" value="<?php setValue("favoriteWidget"); ?> " /> <label for="newsletter">Do you want to receive our newsletter?</label> <input type="checkbox" name="newsletter" id="newsletter" value="yes"<?php setChecked("newsletter", "yes"); ?> /> <label for="comments">Any comments?</label> <textarea name="comments" id="comments" rows="4" cols="50"><?php setValue("comments"); ?> </textarea> <div style="clear: both;"> <input type="submit" name="submitButton" id="nextButton" value="Next >" /> <input type="submit" name="submitButton" id="backButton" value="< Back" style="margin-right: 20px;" /> </div> </div> </form> <?php }
function displayForm($camposPendientes) { cabecera(); if ($camposPendientes) { ?> <p class="error">Hubo algunos problemas con el formulario que usted presentó. Por favor, complete correctamente los campos remarcados de abajo y haga clic en Enviar para volver a enviar el formulario.</p> <?php } else { ?> <p>por favor, rellene sus datos a continuación y haga clic en Enviar. Los campos marcados con un asterisco (*) son obligatorios.</p> <?php } ?> <form action = "" method = "post"> <fieldset> <label for="nombreUsuario" <?php validateField("nombreUsuario", $camposPendientes); ?> >Introduce tu nombre * </label> <input type = "text" name = "nombreUsuario" id="nombreUsuario" value="<?php setValue("nombreUsuario"); ?> "> <label for="apellidos" <?php validateField("apellidos", $camposPendientes); ?> >y tus apellidos *</label> <input type = "text" name = "apellidos" id="apellidos" value="<?php setValue("apellidos"); ?> " ><br><br> <label for="tipoMusica">¿Qué tipo de música te gusta escuchar?</label> <select name="tipoMusica[]" id="tipoMusica" size="4" multiple="multiple"> <option value="Rock"<?php setSelected("tipoMusica", "Rock"); ?> >Rock </option> <option value="Pop"<?php setSelected("tipoMusica", "Pop"); ?> >Pop </option> <option value="Regee"<?php setSelected("tipoMusica", "Regee"); ?> >Regee </option> <option value="Clásica"<?php setSelected("tipoMusica", "Clásica"); ?> >Clásica </option> </select><br><br> ¿Que tipo de libros lees? <br> <label for="novelaNegra">Novela Negra</label> <input type="checkbox" name="tipoLibros[]" id="novelaNegra" value="Novela Negra"<?php setChecked("tipoLibros", "Novela Negra"); ?> ><br> <label for="cienciaFiccion">Ciencia Ficción</label> <input type="checkbox" name="tipoLibros[]" id="cienciaFiccion" value="Ciencia Ficción" <?php setChecked("tipoLibros", "Ciencia Ficción"); ?> ><br> <label for="fantasia">Fantasía</label> <input type="checkbox" name="tipoLibros[]" id="fantasia" value="Fantasía" <?php setChecked("tipoLibros", "Fantasía"); ?> ><br><br> <input type = "submit" name="enviar" value="Enviar"> </fieldset> </form> <?php pie(); }
function displayForm($errorMessages, $missingFields, $member) { displayPageHeader("Sign up for the book club!"); if ($errorMessages) { foreach ($errorMessages as $errorMessage) { echo $errorMessage; } } else { ?> <p>Thanks for choosing to join our book club.</p> <p>To register, please fill in your details below and click Send Details.</p> <p>Fields marked with an asterisk (*) are required.</p> <?php } ?> <form action="register.php" method="post" style="margin-bottom: 50px;"> <div style="width: 30em;"> <input type="hidden" name="action" value="register" /> <label for="username"<?php validateField("username", $missingFields); ?> >Choose a username *</label> <input type="text" name="username" id="username" value="<?php echo $member->getValueEncoded("username"); ?> " /> <label for="password1"<?php if ($missingFields) { echo ' class="error"'; } ?> >Choose a password *</label> <input type="password" name="password1" id="password1" value="" /> <label for="password2"<?php if ($missingFields) { echo ' class="error"'; } ?> >Retype password *</label> <input type="password" name="password2" id="password2" value="" /> <label for="emailAddress"<?php validateField("emailAddress", $missingFields); ?> >Email address *</label> <input type="text" name="emailAddress" id="emailAddress" value="<?php echo $member->getValueEncoded("emailAddress"); ?> " /> <label for="firstName"<?php validateField("firstName", $missingFields); ?> >First name *</label> <input type="text" name="firstName" id="firstName" value="<?php echo $member->getValueEncoded("firstName"); ?> " /> <label for="lastName"<?php validateField("lastName", $missingFields); ?> >Last name *</label> <input type="text" name="lastName" id="lastName" value="<?php echo $member->getValueEncoded("lastName"); ?> " /> <label<?php validateField("gender", $missingFields); ?> >Your gender: *</label> <label for="genderMale">Male</label> <input type="radio" name="gender" id="genderMale" value="m"<?php setChecked($member, "gender", "m"); ?> /> <label for="genderFemale">Female</label> <input type="radio" name="gender" id="genderFemale" value="f"<?php setChecked($member, "gender", "f"); ?> /> <label for="favoriteGenre">What's your favorite genre?</label> <select name="favoriteGenre" id="favoriteGenre" size="1"> <?php foreach ($member->getGenres() as $value => $label) { ?> <option value="<?php echo $value; ?> "<?php setSelected($member, "favoriteGenre", $value); ?> ><?php echo $label; ?> </option> <?php } ?> </select> <label for="otherInterests">What are your other interests?</label> <textarea name="otherInterests" id="otherInterests" rows="4" cols="50"><?php echo $member->getValueEncoded("otherInterests"); ?> </textarea> <div style="clear: both;"> <input type="submit" name="submitButton" id="submitButton" value="Send Details" /> <input type="reset" name="resetButton" id="resetButton" value="Reset Form" style="margin-right: 20px;" /> </div> </div> </form> <?php displayPageFooter(); }
function displayForm($errorMessages, $missingFields, $member) { $logEntries = LogEntry::getLogEntries($member->getValue("id")); displayPageHeader("View member: " . $member->getValueEncoded("firstName") . " " . $member->getValueEncoded("lastName")); if ($errorMessages) { foreach ($errorMessages as $errorMessage) { echo $errorMessage; } } $start = isset($_REQUEST["start"]) ? (int) $_REQUEST["start"] : 0; $order = isset($_REQUEST["order"]) ? preg_replace("/[^ a-zA-Z]/", "", $_REQUEST["order"]) : "username"; ?> <form action="view_member.php" method="post" style="margin-bottom: 50px;"> <div style="width: 30em;"> <input type="hidden" name="memberId" id="memberId" value="<?php echo $member->getValueEncoded("id"); ?> " /> <input type="hidden" name="start" id="start" value="<?php echo $start; ?> " /> <input type="hidden" name="order" id="order" value="<?php echo $order; ?> " /> <label for="username"<?php validateField("username", $missingFields); ?> >Username *</label> <input type="text" name="username" id="username" value="<?php echo $member->getValueEncoded("username"); ?> " /> <label for="password">New password</label> <input type="password" name="password" id="password" value="" /> <label for="emailAddress"<?php validateField("emailAddress", $missingFields); ?> >Email address *</label> <input type="text" name="emailAddress" id="emailAddress" value="<?php echo $member->getValueEncoded("emailAddress"); ?> " /> <label for="firstName"<?php validateField("firstName", $missingFields); ?> >First name *</label> <input type="text" name="firstName" id="firstName" value="<?php echo $member->getValueEncoded("firstName"); ?> " /> <label for="lastName"<?php validateField("lastName", $missingFields); ?> >Last name *</label> <input type="text" name="lastName" id="lastName" value="<?php echo $member->getValueEncoded("lastName"); ?> " /> <label for="joinDate"<?php validateField("joinDate", $missingFields); ?> >Joined on *</label> <input type="text" name="joinDate" id="joinDate" value="<?php echo $member->getValueEncoded("joinDate"); ?> " /> <label<?php validateField("gender", $missingFields); ?> >Gender *</label> <label for="genderMale">Male</label> <input type="radio" name="gender" id="genderMale" value="m"<?php setChecked($member, "gender", "m"); ?> /> <label for="genderFemale">Female</label> <input type="radio" name="gender" id="genderFemale" value="f"<?php setChecked($member, "gender", "f"); ?> /> <label for="favoriteGenre">Favorite genre</label> <select name="favoriteGenre" id="favoriteGenre" size="1"> <?php foreach ($member->getGenres() as $value => $label) { ?> <option value="<?php echo $value; ?> "<?php setSelected($member, "favoriteGenre", $value); ?> ><?php echo $label; ?> </option> <?php } ?> </select> <label for="otherInterests">Other interests</label> <textarea name="otherInterests" id="otherInterests" rows="4" cols="50"><?php echo $member->getValueEncoded("otherInterests"); ?> </textarea> <div style="clear: both;"> <input type="submit" name="action" id="saveButton" value="Save Changes" /> <input type="submit" name="action" id="deleteButton" value="Delete Member" style="margin-right: 20px;" /> </div> </div> </form> <h2>Access log</h2> <table cellspacing="0" style="width: 30em; border: 1px solid #666;"> <tr> <th>Web page</th> <th>Number of visits</th> <th>Last visit</th> </tr> <?php $rowCount = 0; foreach ($logEntries as $logEntry) { $rowCount++; ?> <tr<?php if ($rowCount % 2 == 0) { echo ' class="alt"'; } ?> > <td><?php echo $logEntry->getValueEncoded("pageUrl"); ?> </td> <td><?php echo $logEntry->getValueEncoded("numVisits"); ?> </td> <td><?php echo $logEntry->getValueEncoded("lastAccess"); ?> </td> </tr> <?php } ?> </table> <div style="width: 30em; margin-top: 20px; text-align: center;"> <a href="view_members.php?start=<?php echo $start; ?> &order=<?php echo $order; ?> ">Back</a> </div> <?php displayPageFooter(); }
// output the error message echo $errors['garageURL']; } ?> </span> </div> <div class="form-group form-control"> <!--keeps form data together--> Overnight Facility? Yes<input type="checkbox" id="overnighty" type="checkbox" name="overnighty" value="Yes" <?php setChecked($formdata, 'overnighty', 'Yes'); ?> /> No<input type="checkbox" id="overnightn" type="checkbox" name="overnightn" value="No"<?php setChecked($formdata, 'overnightn', 'No'); ?> /> </div> <div class="form-group"> <!--keeps form data together--> <input type="submit" id="addgarage" value="Add Garage" name="add" class="btn btn-success"> </div> <!-- Closing data area --> <!-- Closing form area -->
function displayForm2() { $datos = array( "error" => "", "scriptUrl" => "", "valorNombreUsuario" => setValue("nombre"), "valorApellidos" => setValue("apellidos"), "direccion" => setValue("direccion"), "telefono" => setValue("telefono"), "email" => setValue("email"), "foto" => $_FILES['foto']['name'], "ciudadesRoma" => setSelected('ciudades', 'Roma'), "ciudadesParis" => setSelected('ciudades', 'Paris'), "ciudadesNuevaYork" =>setSelected('ciudades', 'Nueva York'), "ciudadesLondres" =>setSelected('ciudades', 'Londres'), "ciudadesBerlin" => setSelected('ciudades', 'Berlin'), "ciudadesAtenas" => setSelected('ciudades', 'Atenas'), "informacionCorreoPostal" => setChecked('informacion', 'Correo Postal'), "informacionEmail" => setChecked("informacion", 'Email'), "valorMayorEdad" => setValue("mayorEdad") ); $plantilla = "plantillas/paso2.html"; $formulario = vista($datos, $plantilla); $datos = array( "titulo" => TITULO, "formulario" => $formulario ); $plantilla = "plantillas/plantilla.html"; $html = vista($datos, $plantilla); print ($html); }
function student_information($missingFields, $adultStudent) { $output = '学生(Student):<br/>' . "\n"; $output .= '<table>'; $output .= '<tr><th' . validateField("stu_last_name", $missingFields) . '><label for="stu_last_name">Last Name</label></th>' . '<th' . validateField("stu_first_name", $missingFields) . '><label for="stu_first_name">First Name</label></th>' . '<th' . validateField("stu_gender", $missingFields) . '><label for="stu_gender">Gender</label></th>' . ($adultStudent ? '' : '<th>Birth Date</th>') . '<th' . validateField("stu_phone", $missingFields) . '><lable for="stu_phone">Phone</label></th>' . ($adultStudent ? '<th' . validateField("stu_email", $missingFields) . '><lable for="stu_email">Email</label></th>' : '') . '</tr>' . "\n"; $output .= '<tr><td><input style="width:98%;" type="text" name="stu_last_name" placeholder="Student Last Name" value="' . setValue("stu_last_name") . '" requiredxx </td>'; $output .= '<td><input style="width:98%;" type="text" name="stu_first_name" placeholder="Student First Name" value="' . setValue("stu_first_name") . '" requiredxx </td>'; $output .= '<td><label for="stu_gender"><input type="radio" class="radio" name="stu_gender" value="M" ' . setChecked("stu_gender", "M") . '/>Male</label> <label for="stu_gender"><input type="radio" class="radio" name="stu_gender" value="F" ' . setChecked("stu_gender", "F") . '/>Female</label> </td>'; if (!$adultStudent) { $output .= '<td><input style="width:98%;" type="date" name="stu_birth_date" value=""</td>'; } $output .= '<td><input style="width:98%;" type="tel" name="stu_phone" placeholder="Student Phone Num" value="' . setValue("stu_phone") . '" requiredxx </td>'; if ($adultStudent) { $output .= '<td><input style="width:98%;" type="email" name="stu_email" placeholder="Student Email" value="' . setValue("stu_email") . '" requiredxx </td></tr>' . "\n"; } else { $output .= '</tr>' . "\n"; } $output .= '<tr><th colspan="2">City</th><th>State</th><th colspan="2">Zip</th></tr>' . "\n"; $output .= '<tr><td colspan="2"><input type="text" name="stu_city" value="' . setValue("stu_city") . '"</td>'; $output .= '<td><input style="width:98%;" type="text" name="stu_state" value="' . setValue("stu_state") . '"</td>'; $output .= '<td colspan=2><input type="text" name="stu_zip" value="' . setValue("stu_zip") . '"</td></tr></table>' . "\n"; if (!$adultStudent) { $output .= '父母/监护人(Parent/Guardien):<br/>' . "\n"; $output .= '<table>'; $output .= '<tr><th' . validateField("parent1_last_name", $missingFields) . '>Last Name</th>' . '<th' . validateField("parent1_first_name", $missingFields) . '>First Name</th><th>Relation</th>' . '<th' . validateField("parent1_phone", $missingFields) . '>Phone</th>' . '<th' . validateField("parent1_email", $missingFields) . '>Email</th></tr>' . "\n"; $output .= '<tr><td><input style="width:98%;" type="text" name="parent1_last_name" placeholder="First Guardien Last Name" value="' . setValue("parent1_last_name") . '" requiredxx </td>'; $output .= '<td><input style="width:98%;" type="text" name="parent1_first_name" placeholder="First Guardien First Name" value="' . setValue("parent1_first_name") . '" requiredxx "</td>'; $output .= '<td><input style="width:98%;" type="text" name="parent1_relation" value="' . setValue("parent1_relation") . '"</td>'; $output .= '<td><input style="width:98%;" type="text" name="parent1_phone" placeholder="First Guardien Phone Num" value="' . setValue("parent1_phone") . '" requiredxx </td>'; $output .= '<td><input style="width:98%;" type="email" name="parent1_email" placeholder="First Guardien Email" value="' . setValue("parent1_email") . '" requiredxx </td></tr>'; $output .= '<tr><td><input style="width:98%;" type="text" name="parent2_last_name" value="' . setValue("parent2_last_name") . '"</td>'; $output .= '<td><input style="width:98%;" type="text" name="parent2_first_name" value="' . setValue("parent2_first_name") . '"</td>'; $output .= '<td><input style="width:98%;" type="text" name="parent2_relation" value="' . setValue("parent2_relation") . '"</td>'; $output .= '<td><input style="width:98%;" type="text" name="parent2_phone" value="' . setValue("parent2_phone") . '"</td>'; $output .= '<td><input style="width:98%;" type="email" name="parent2_email" value="' . setValue("parent2_email") . '"</td></tr></table>'; } return $output; }
" /></p> <p>Date of birth:<input type="text" name="dob" value="<?php setVal($formdata, 'dob'); ?> " /></p> <p>Id Number:<input type="password" name="id" value="<?php setVal($formdata, 'id'); ?> " /></p> <p>Gender:</p> Male <input type="radio" name="sex" value= "male"<?php setChecked($formdata, 'sex', 'male'); ?> /> Female<input type="radio" name="sex" value="female" <?php setChecked($formdata, 'sex', 'female'); ?> /> <p> Do you like this Website? <input type="radio" checked="checked" name="answer" value="Yes" /> Yes <input type="radio" name="answer" value="No" />No </p> <p>Whats your favourite feature? <select name="favourite_feature"> <option>Images</option> <option>Design</option> <option selected="selected">Content</option> </select></p> <p>Feedback: