本文整理汇总了PHP中displayForm函数的典型用法代码示例。如果您正苦于以下问题:PHP displayForm函数的具体用法?PHP displayForm怎么用?PHP displayForm使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了displayForm函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: processForm2
function processForm2()
{
$comprobando = false;
$nombre = $_POST["nombre"];
$apellidos = $_POST["apellidos"];
if (!empty($_POST["nombre"]) && !empty($_POST["apellidos"])) {
if (preg_match("/^[-]*[0-9]+\$/", $numMenor) && preg_match("/^[-]*[0-9]+\$/", $numMayor)) {
$comprobando = true;
}
if ($comprobando) {
echo "Lista de pares de numeros de {$numMenor} y {$numMayor} <br>";
for ($i = $numMenor, $j = $numMayor; $i <= $numMayor; $i++, $j--) {
echo "({$i},{$j}) ";
}
echo "<a href='Ejer12.php'>Volver</a>";
} else {
if (!empty($_POST["nombre"])) {
displayForm("Introduce correctamente el nombre");
}
}
if (!empty($_POST["apellidos"])) {
displayForm("Introduce correctamente el nombre");
}
}
}
示例2: procesForm
function procesForm()
{
// El formulario se ha ejecutado, así que trabajamos con sus datos
$userName = filter_input(INPUT_POST, "userName");
if (isset($_POST["userName"]) and !empty($_POST["userName"])) {
print "<h2>Hola, {$userName}!</h2> \n";
} else {
$mensaje = "<b>No has introducido el nombre.</b>";
displayForm($mensaje);
}
}
示例3: procesForm
function procesForm()
{
$num1 = $_POST["numero1"];
$num2 = $_POST["numero2"];
$num3 = $_POST["numero3"];
if (is_numeric($num1) && is_numeric($num2) && is_numeric($num3)) {
echo 'el numero mayor es: ';
numMayor($num1, $num2, $num3);
} else {
echo "dato no numerico";
displayForm();
}
}
示例4: veriForm
function veriForm()
{
$camposObligatorios = array("nombreUsuario", "apellidos");
$camposPendientes = array();
foreach ($camposObligatorios as $campoObligatorio) {
if (!isset($_POST[$campoObligatorio]) or !$_POST[$campoObligatorio] or !preg_match("/^[a-zA-Z][a-zA-Z ]+\$/", $_POST[$campoObligatorio])) {
$camposPendientes[] = $campoObligatorio;
}
}
if ($camposPendientes) {
displayForm($camposPendientes);
} else {
procesForm();
}
}
示例5: procesForm
function procesForm()
{
$camposObligatorios = array("nombre");
$camposPendientes = array();
foreach ($camposObligatorios as $obligatorio) {
if (!isset($_POST["{$obligatorio}"]) or !$_POST["{$obligatorio}"] or !preg_match("/^[-]?[0-9]+\$/", $_POST["{$obligatorio}"])) {
$camposPendientes[] = $obligatorio;
}
}
if ($camposPendientes) {
displayForm($camposPendientes);
} else {
displayResultado();
}
}
示例6: processForm
function processForm()
{
$requiredFields = array("firstName", "lastName", "password1", "password2", "gender");
$missingFields = array();
foreach ($requiredFields as $requiredField) {
if (!isset($_POST[$requiredField]) or !$_POST[$requiredField]) {
$missingFields[] = $requiredField;
}
}
if ($missingFields) {
displayForm($missingFields);
} else {
displayThanks();
}
}
示例7: processForm
function processForm()
{
$number = (int) $_POST["number"];
$guessesLeft = (int) $_POST["guessesLeft"] - 1;
$guess = (int) $_POST["guess"];
if ($guess == $number) {
displaySuccess($number);
} elseif ($guessesLeft == 0) {
displayFailure($number);
} elseif ($guess < $number) {
displayForm($number, $guessesLeft, "Too low - try again!");
} else {
displayForm($number, $guessesLeft, "Too high - try again!");
}
}
示例8: displayFormElements
function displayFormElements($message)
{
$elementos = $_POST['elementos'];
if (is_array($elementos) && checkEmptyForm($elementos)) {
displayform("");
$suma = 0;
echo 'El vector tiene ' . count($elementos) . ' elementos<br>';
for ($i = 0; $i < count($elementos); $i++) {
echo "{$i} = {$elementos[$i]}" . '<br>';
$suma += $elementos[$i];
}
echo "La suma es: {$suma}";
} else {
displayForm("Error!! No todos los campos del array son correctos!");
displayElements(count($elementos));
}
}
示例9: processForm2
function processForm2()
{
$elementos = $_POST["elementos"];
$mensaje = '';
$suma = 0;
if (!isset($_POST["enviar"])) {
$mensaje = "Hubo algunos problemas con el formulario<br>";
displayForm($mensaje);
} else {
displayForm($mensaje);
echo "El vector tiene " . count($elementos) . "elementos<br>";
for ($i = 0; $i < count($elementos); $i++) {
echo "{$i} = {$elementos[$i]}<br>";
$suma = $suma + $elementos[$i];
}
echo "la suma de los elementos es: {$suma}";
}
}
示例10: processForm
function processForm()
{
$comprobando = false;
$num = $_POST["num"];
if (!empty($_POST["num"])) {
if (preg_match("/^[-]*[0-9]+\$/", $num)) {
$comprobando = true;
}
if ($comprobando) {
echo "Tabla de multiplicar del {$num} <br>";
for ($j = 0; $j <= 10; $j++) {
echo "{$j} x {$num} = " . $j * $num . "<br>";
}
echo "<a href='Ejer11.php'>Volver</a>";
} else {
displayForm("Introduce correctamente el numero a multiplicar");
}
}
}
示例11: procesForm
function procesForm()
{
if (preg_match("/^[0-9]+\$/", $_POST["pesetas"]) && isset($_POST["moneda"])) {
$pesetas = $_POST["pesetas"];
$conversor = $_POST["moneda"];
switch ($conversor) {
case 'euros':
echo conversorEuros($pesetas);
break;
case 'dolares':
echo conversorDolares($pesetas);
break;
case 'yenes':
echo conversorYenes($pesetas);
break;
}
} else {
$mensaje = "<p class='error'>Hubo algunos problemas con el formulario que usted presentó.\nPor favor, rellene el campo <b>pesetas</b> correctamente.</p>";
displayForm($mensaje);
}
}
示例12: processForm
function processForm()
{
$requiredFields = array("username", "password");
$missingFields = array();
$errorMessages = array();
$member = new Member(array("username" => isset($_POST["username"]) ? preg_replace("/[^ \\-\\_a-zA-Z0-9]/", "", $_POST["username"]) : "", "password" => isset($_POST["password"]) ? preg_replace("/[^ \\-\\_a-zA-Z0-9]/", "", $_POST["password"]) : ""));
foreach ($requiredFields as $requiredField) {
if (!$member->getValue($requiredField)) {
$missingFields[] = $requiredField;
}
}
if ($missingFields) {
$errorMessages[] = '<p class="error">There were some missing fields in the form you submitted. Please complete the fields highlighted below and click Login to resend the form.</p>';
} elseif (!($loggedInMember = $member->authenticate())) {
$errorMessages[] = '<p class="error">Sorry, we could not log you in with those details. Please check your username and password, and try again.</p>';
}
if ($errorMessages) {
displayForm($errorMessages, $missingFields, $member);
} else {
$_SESSION["member"] = $loggedInMember;
displayThanks();
}
}
示例13: changePassword
function changePassword($passwordChangeType)
{
$infos = null;
$errors = null;
try {
if ($passwordChangeType == 'set' && isset($_POST['userId']) && isset($_POST['passwordOne'])) {
if ($_POST['passwordOne'] == $_POST['passwordConfirm']) {
WorkbenchContext::get()->getPartnerConnection()->setPassword($_POST['userId'], $_POST['passwordOne']);
$infos[] = "Successfully set password for " . $_POST['userId'];
} else {
$errors[] = "Passwords must match, and don't be sneaky and turn off JavaScript";
}
} else {
if ($passwordChangeType == 'reset' && isset($_POST['userId'])) {
$changePasswordResult = WorkbenchContext::get()->getPartnerConnection()->resetPassword($_POST['userId']);
$infos[] = "Successfully reset password for " . $_POST['userId'];
}
}
} catch (Exception $e) {
$errors[] = $e->getMessage();
}
displayForm($infos, $errors);
}
示例14: processForm
function processForm()
{
$comprobando = true;
$nums = $_POST["num"];
for ($j = 0; $j < count($nums); $j++) {
if (!empty($_POST["num[{$j}]"])) {
if (!preg_match("/^[-]*[0-9]+\$/", $nums[$j])) {
$comprobando = false;
}
}
}
if ($comprobando) {
echo "El vector tiene " . count($nums) . " elementos<br>";
$suma = 0;
for ($i = 0; $i < count($nums); $i++) {
echo $i . " = " . $nums[$i] . "<br>";
$suma = $suma + $nums[$i];
}
echo "La suma de los numeros es: {$suma}";
displayForm("");
} else {
displayForm("Introduce correctamente los numeros");
}
}
示例15: procesForm
<!--
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
/*
* Autor= Javi
* Fecha= 30-oct-2015
* Licencia= default
* Version= Expression version is undefined on line 10, column 14 in Templates/Scripting/EmptyPHP.php.
* Descripcion=
* /
-->
<html>
<head>
<meta charset ="UTF-8" />
<title></title>
</head>
<body>
<?php
include_once 'funcionesRelleno.php';
include_once 'funcionesEjer1.php';
if (isset($_POST["enviar"])) {
procesForm();
} else {
displayForm(array());
}
?>
</body>
</html>