当前位置: 首页>>代码示例>>PHP>>正文


PHP displayForm函数代码示例

本文整理汇总了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");
        }
    }
}
开发者ID:cancelajavi,项目名称:2-DAW,代码行数:25,代码来源:funcionesEjer14.php

示例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);
    }
}
开发者ID:cancelajavi,项目名称:2-DAW,代码行数:11,代码来源:ProbarCodigoJunto.php

示例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();
    }
}
开发者ID:cancelajavi,项目名称:2-DAW,代码行数:13,代码来源:Ejer4.php

示例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();
    }
}
开发者ID:cancelajavi,项目名称:2-DAW,代码行数:15,代码来源:funciones.php

示例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();
    }
}
开发者ID:cancelajavi,项目名称:2-DAW,代码行数:15,代码来源:funcionesEjer2.php

示例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();
    }
}
开发者ID:raynaldmo,项目名称:php-education,代码行数:15,代码来源:registration.php

示例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!");
    }
}
开发者ID:raynaldmo,项目名称:php-education,代码行数:15,代码来源:exercise1.php

示例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));
    }
}
开发者ID:cancelajavi,项目名称:2-DAW,代码行数:17,代码来源:funcionesEjercicio13.php

示例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}";
    }
}
开发者ID:cancelajavi,项目名称:2-DAW,代码行数:18,代码来源:funcionesEjer13.php

示例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");
        }
    }
}
开发者ID:cancelajavi,项目名称:2-DAW,代码行数:19,代码来源:funcionesEjer11.php

示例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);
    }
}
开发者ID:cancelajavi,项目名称:2-DAW,代码行数:21,代码来源:funcionesEjer7.php

示例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();
    }
}
开发者ID:raynaldmo,项目名称:php-education,代码行数:23,代码来源:login.php

示例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);
}
开发者ID:sivarajankumar,项目名称:forceworkbench,代码行数:23,代码来源:pwdMgmt.php

示例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");
    }
}
开发者ID:cancelajavi,项目名称:2-DAW,代码行数:24,代码来源:funcionesEjer10.php

示例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>
开发者ID:cancelajavi,项目名称:2-DAW,代码行数:31,代码来源:ejer1.php


注:本文中的displayForm函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。