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


PHP printForm函数代码示例

本文整理汇总了PHP中printForm函数的典型用法代码示例。如果您正苦于以下问题:PHP printForm函数的具体用法?PHP printForm怎么用?PHP printForm使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了printForm函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: processForm

function processForm()
{
    $db = new DB_Functions();
    $error_msg = "";
    //validate user input
    if ($_POST['currency'] == "") {
        printForm();
        echo "Invalid Currency Entered.\n";
        return;
    } else {
        if ($_POST['buyingRate'] == "") {
            printForm();
            echo "Invalid Buying Rate.\n";
            return;
        } else {
            if ($_POST['sellingRate'] == "") {
                printForm();
                echo "Invalid Selling Rate.\n";
                return;
            }
        }
    }
    //save data to table
    $result = $db->addExchangeRate($_POST['currency'], $_POST['buyingRate'], $_POST['sellingRate']);
    if (!$result == false) {
        //data was successfully saved to database
        header('Location: http://localhost/eserver/account.php');
    } else {
        $error_msg = "Data could not be saved in database.\n";
        printForm();
    }
}
开发者ID:zuozhiyu,项目名称:BankingApp-Server,代码行数:32,代码来源:createNewCurrency.php

示例2: handleForm

function handleForm()
{
    global $db;
    $firstname = $_POST['firstname'];
    $lastname = $_POST['lastname'];
    $email = $_POST['email'];
    $role = $_POST['role'];
    $f = $s = $e = $r = "";
    if (isset($_POST['save'])) {
        //save one record
        $statement = "INSERT INTO users (firstname, lastname, email, type) VALUES\n    ('{$firstname}','{$lastname}','{$email}','{$role}')";
        if ($result = mysqli_query($db, $statement)) {
            echo "<h3 style='color: green'>One row added to the database</h3>";
        } else {
            echo "<h3 style='color: red'>There was a problem saving your data</h3>";
        }
    } elseif (isset($_POST['amend'])) {
        //alter one record
        $statement = "UPDATE users SET firstname='{$firstname}', lastname='{$lastname}', type='{$role}' WHERE email='{$email}'";
        if ($result = mysqli_query($db, $statement)) {
            echo "<h3 style='color: green'>Database updated successfully</h3>";
        } else {
            echo "<h3 style='color: red'>There was a problem updating your data</h3>";
        }
    } elseif (isset($_POST['delete'])) {
        //delete one record
        $statement = "DELETE FROM users WHERE email='{$email}'";
        if ($result = mysqli_query($db, $statement)) {
            echo "<h3 style='color: green'>One row deleted from the database</h3>";
        } else {
            echo "<h3 style='color: red'>There was a problem deleting your data. Make sure that you entered the correct email address.</h3>";
        }
    } elseif (isset($_POST['view'])) {
        //view one record
        $statement = "SELECT * FROM users WHERE email='{$email}'";
        if ($result = mysqli_query($db, $statement)) {
            echo "<h3>Your query returned</h3>";
            $data = mysqli_fetch_object($result);
            $f = $data->firstname;
            $s = $data->lastname;
            $e = $data->email;
            $r = $data->type;
        } else {
            echo "<h3 style='color: red'>There was a problem finding the row. Please check that you entered the correct email address</h3>";
        }
    } else {
        //must be showall
        $statement = "SELECT * FROM users";
        if ($result = mysqli_query($db, $statement)) {
            echo "<h3>Your query returned</h3><table border='1'>";
            while ($data = mysqli_fetch_object($result)) {
                echo "<tr><td>{$data->firstname}</td><td>{$data->lastname}</td>\n          <td>{$data->email}</td><td>{$data->type}</td></tr>";
            }
            echo "</table>";
        } else {
            echo "<h3 style='color: red'>There was a problem retrieving data.</h3>";
        }
    }
    printForm($f, $s, $e, $r);
}
开发者ID:Virunee,项目名称:database,代码行数:60,代码来源:index.php

示例3: checkForm

function checkForm()
{
    global $name, $pwd;
    if ($_POST['show']) {
        echo "<h3>Cookie contains " . $_COOKIE["UserDetails"] . "</h3>";
    } else {
        if (!$name || !$pwd) {
            echo "<h3>Please enter username and password</h3>";
        } else {
            echo "<h3>You submitted {$name} and {$pwd}</h3>";
        }
    }
    printForm();
}
开发者ID:Virunee,项目名称:cookie,代码行数:14,代码来源:index.php

示例4: checkForm

function checkForm()
{
    global $name, $pwd;
    if (isset($_POST['show'])) {
        echo "<h3>Session contains " . $_SESSION["user"] . " and " . $_SESSION["pwd"] . "</h3>";
        echo "<h3>You have logged on " . $_SESSION["counter"] . " times</h3>";
    } else {
        if (!$name || !$pwd) {
            echo "<h3>Please enter username and password</h3>";
        } else {
            echo "<h3>You submitted {$name} and {$pwd}</h3>";
        }
    }
    printForm();
}
开发者ID:Virunee,项目名称:cookie,代码行数:15,代码来源:sessions.php

示例5: extract

      </style> 
   </head>
   <body> 
      <?php 
extract($_REQUEST);
// create form variables
error_reporting(E_ALL & ~E_NOTICE);
// get rid of runtime notices
error_reporting(E_ALL ^ E_DEPRECATED);
$sql = "SELECT * FROM yang_ning_artists";
connect();
$result = mysql_query($sql, $conn);
mysql_close();
if (!$result) {
    createTables();
    printForm();
} else {
    $action = isset($_REQUEST['switch']) ? $_REQUEST['switch'] : null;
    switch ($action) {
        case '1':
            printform();
            break;
        case '2':
            // add artist into db
            $artist = $_REQUEST['artist'];
            // get data
            $sql = "INSERT INTO yang_ning_artists VALUES( NULL, '{$artist}')";
            // write query
            connect();
            // write to db
            $result = mysql_query($sql, $conn) or die("<br>Error storing Artist to db in Case 2: " . mysql_error());
开发者ID:steve402791890,项目名称:CS85,代码行数:31,代码来源:createTables.php

示例6: __construct

 public function __construct()
 {
     $message = $this->testTheEnvironment();
     if (is__writable("./") && !file_exists(".htaccess")) {
         file_put_contents(".htaccess", htaccess());
     }
     $this->generateSiteUrl();
     if (!empty($message)) {
         printHeader();
         echo $message;
         echo "</body>";
         echo "</html>";
     } elseif ($this->runForm()) {
         unlink(__FILE__);
         header("Location:" . $this->siteUrl . "add/post");
         exit;
     } else {
         $updater = new Updater();
         $version = $updater->getInfos();
         printHeader($version);
         printForm();
         echo "</body>";
         echo "</html>";
     }
 }
开发者ID:pianove,项目名称:htmly-installer,代码行数:25,代码来源:Settings.php

示例7: processForm

function processForm()
{
    $db = new DB_Functions();
    //validate user input
    if ($_POST['rangeFrom'] == "") {
        printForm();
        echo "Invalid From Range.\n";
        return;
    } else {
        if ($_POST['rangeTo'] == "") {
            printForm();
            echo "Invalid Invalid Range To.\n";
            return;
        } else {
            if ($_POST['1MonthPa'] == "") {
                printForm();
                echo "Invalid 1 month pa Value.\n";
                return;
            } else {
                if ($_POST['3MonthPa'] == "") {
                    printForm();
                    echo "Invalid 3 month pa Value.\n";
                    return;
                } else {
                    if ($_POST['6MonthPa'] == "") {
                        printForm();
                        echo "Invalid 6 month pa Value.\n";
                        return;
                    } else {
                        if ($_POST['1YearPa'] == "") {
                            printForm();
                            echo "Invalid 1 Year pa Value.\n";
                            return;
                        }
                    }
                }
            }
        }
    }
    //save data to table
    $result = $db->addFixedDepositRate($_POST['rangeFrom'], $_POST['rangeTo'], $_POST['1MonthPa'], $_POST['3MonthPa'], $_POST['6MonthPa'], $_POST['1YearPa']);
    if (!$result == false) {
        //data was successfully saved to database
        header('Location: http://localhost/eserver/account.php');
    } else {
        $error_msg = "Data could not be saved in database.\n";
        printForm();
    }
}
开发者ID:zuozhiyu,项目名称:BankingApp-Server,代码行数:49,代码来源:createNewFixedDeposit.php

示例8: processForm

function processForm()
{
    $db = new DB_Functions();
    $error_msg = "";
    //validate user input
    if ($_POST['ad'] == "") {
        printForm();
        echo "Invalid Adert value.\n";
        return;
    } else {
        if ($_POST['ad_url'] == "") {
            printForm();
            echo "Invalid Advert URL value.\n";
            return;
        } else {
            if ($_POST['ad_category'] == "") {
                printForm();
                echo "Invalid Advert category value.\n";
                return;
            }
        }
    }
    //save data to table
    $result = $db->addNewAdvert($_POST['ad'], $_POST['ad_url'], $_POST['ad_category']);
    if (!$result == false) {
        //data was successfully saved to database
        header('Location: http://localhost/eserver/account.php');
    } else {
        $error_msg = "Data could not be saved in database.\n";
        printForm();
    }
}
开发者ID:zuozhiyu,项目名称:BankingApp-Server,代码行数:32,代码来源:createNewAd.php

示例9: isset

$tag = isset($_GET["tag"]) ? $_GET["tag"] : '';
if (!isValidTag($tag)) {
    $message = "The tag that was requested (<code>" . htmlentities($tag) . "</code>) is not a valid tag. You can request a new tag.";
    printError($message);
} elseif (!tagExists($tag)) {
    $message = "The tag that was requested (<code>" . $tag . "</code>) does not exist in the Stacks project. You can request a new tag.";
    printError($message);
} else {
    $meta = json_decode(file_get_contents("http://" . $_SERVER["HTTP_HOST"] . href("data/tag/" . $tag . "/meta")));
    if (in_array($meta->type, array("lemma", "proposition", "remark", "remarks", "theorem"))) {
        print "<p>You can suggest a slogan for <a href='" . href("tag/" . $tag) . "'>tag <code>" . $tag . "</code></a> (label: <code style='font-size: .9em'>" . $meta->label . "</code>), located in<br>";
        $id = explode(".", $meta->book_id);
        print "&nbsp&nbsp;Chapter " . $id[0] . ": " . parseAccents($meta->chapter_name) . "<br>";
        print "&nbsp&nbsp;Section " . $id[1] . ": " . parseAccents($meta->section_name);
        printStatement($tag);
        printForm($tag);
        $slogans = getSlogans($tag);
        if (!empty($slogans) or $meta->slogan != "") {
            printSlogans($slogans, $meta->slogan);
        }
    } else {
        $message = "The tag that was requested (<code>" . $tag . "</code>) is of type <code>" . $meta->type . "</code>, but it is impossible to write slogans for tags of this type.";
        printError($message);
    }
}
?>

<script type="text/javascript" src="slogan.js"></script>
<?php 
if (isset($_SESSION["tag"]) && isset($_GET["tag"])) {
    print "<script type='text/javascript'>";
开发者ID:robertcardona,项目名称:stacks-website,代码行数:31,代码来源:input.php

示例10: rawurldecode

<html>
<head>
<?php 
if ($term) {
    echo "<title>" . rawurldecode($term) . " - mookie's minisearch</title>";
} else {
    echo "<title>mookie's minisearch</title>";
}
?>
<link rel="stylesheet" type="text/css" media="screen" href="style.css"/>
<link rel="search" type="application/opensearchdescription+xml" title="moookie's minisearch" href="minisearch.xml">
</head>
<body>
<div id="wrap">
<?php 
printForm($term);
if ($term && $type == 'both') {
    print "<div id=\"main\">";
    searchFor($term, $start, $count, $appid, $type);
    print "</div>";
    print "<div id=\"sidebar\">";
    print "<b>Results from <a href=\"http://www.twitter.com\">Twitter</a>...</b>";
    searchTwitterFor($term, $start, $count, $type);
    print "</div>";
    print "</div>";
    printFoot();
} else {
    if ($term && $type == 'twitter') {
        $count = $count * $twitMulti;
        print "<div id=\"single\">";
        searchTwitterFor($term, $start, $count, $type);
开发者ID:ultramookie,项目名称:mookie-s-minisearch,代码行数:31,代码来源:index.php

示例11: printForm

</form>
</body>
</html>
END;
}
if (isset($_POST['pass'])) {
    if ($_POST['pass'] == $password) {
        // Successfully logged in.
        // Continue to page content.
        $_SESSION['LOGIN'] = "ADMIN";
    } else {
        // Wrong password submitted.
        printForm('Wrong password');
        exit;
    }
} else {
    if (isset($_GET['logout'])) {
        unset($_SESSION['LOGIN']);
        session_destroy();
        printForm('Logged Out');
        exit;
    } else {
        if (isset($_SESSION['LOGIN'])) {
            // Cookie already set login not required.
            // Continue to page content.
        } else {
            printForm('Please login');
            exit;
        }
    }
}
开发者ID:jeryj,项目名称:homeschool-time-tracking,代码行数:31,代码来源:login.php

示例12: fclose

        fclose($fp);
        rptout("数据文件" . $bakfile . "恢复成功!\n");
        $fileid++;
    }
    mysql_close($link);
    unlink('include/mall_config.tmp.php');
    unlink('migtask.txt');
    unlink('mig.php');
    $dirhandle = @opendir('databack');
    while ($file_name = @readdir($dirhandle)) {
        if (substr($file_name, 0, 4) == 'mig_') {
            unlink("databack/{$file_name}");
        }
    }
} else {
    printForm('');
}
//mysqldump
class Mysqldumper
{
    var $_host;
    var $_dbuser;
    var $_dbpassword;
    var $_dbname;
    var $_isDroptables;
    var $tableid;
    //数据表ID
    var $startid;
    var $tablearr;
    var $nodata;
    function Mysqldumper($host = "localhost", $dbuser = "", $dbpassword = "", $dbname = "")
开发者ID:dalinhuang,项目名称:shopexts,代码行数:31,代码来源:mig.php

示例13: processForm

function processForm()
{
    $db = new DB_Functions();
    $error_msg = "";
    //validate user input
    if ($_POST['companyName'] == "") {
        printForm();
        echo "Invalid Company Name.\n";
        return;
    } else {
        if ($_POST['lastTradedPrice'] == "") {
            printForm();
            echo "Invalid Last Traded Price Value.\n";
            return;
        } else {
            if ($_POST['previousPrice'] == "") {
                printForm();
                echo "Invalid Previous Price Value.\n";
                return;
            }
        }
    }
    //save data to table
    $change = $_POST['lastTradedPrice'] - $_POST['previousPrice'];
    $result = $db->addShareListingEntry($_POST['companyName'], $_POST['lastTradedPrice'], $_POST['previousPrice'], $change);
    if (!$result == false) {
        //data was successfully saved to database
        header('Location: http://localhost/eserver/account.php');
    } else {
        $error_msg = "Data could not be saved in database.\n";
        printForm();
    }
}
开发者ID:zuozhiyu,项目名称:BankingApp-Server,代码行数:33,代码来源:createAShareListing.php

示例14: processForm

function processForm()
{
    $db = new DB_Functions();
    $error_msg = "";
    //validate user input
    if ($_POST['adminname'] == "") {
        printForm();
        echo "Invalid Name.\n";
        return;
    } else {
        if ($_POST['idNo'] == "") {
            printForm();
            echo "Invalid IdNo.\n";
            return;
        } else {
            if ($_POST['password'] == "") {
                printForm();
                echo "Invalid Password.\n";
                return;
            } else {
                if ($_POST['password'] != $_POST['passwordConfirm']) {
                    printForm();
                    echo "Passwords do not match!\n";
                    return;
                } else {
                    if ($_POST['username'] == "") {
                        printForm();
                        echo "Invalid Username.\n";
                        return;
                    }
                }
            }
        }
    }
    //save data to table
    $result = $db->administratorSignUp($_POST['username'], md5($_POST['password']), $_POST['idNo'], $_POST['adminname']);
    if (!$result == false) {
        //data was successfully saved to database
        header('Location: http://localhost/eserver/account.php');
    } else {
        $error_msg = "Data could not be saved in database.\n";
        printForm();
    }
}
开发者ID:zuozhiyu,项目名称:BankingApp-Server,代码行数:44,代码来源:createNewAdmin.php

示例15: PHPZip

        $z = new PHPZip();
        $z->Zip($files, TARGET, "pictures/big/big." . $vol . ".zip");
        unset($z);
        rptout("volume \t\t" . $vol . " (" . $_REQUEST['total'] . ") finished!");
        //下一卷,控制从0开始,
        $vol++;
        //停3秒,不然服务器会挂掉
        sleep(3);
        jump("?act=do&vol=" . $vol . "&total=" . $_REQUEST['total']);
    } else {
        printForm("<hr><b>Total " . $_REQUEST['total'] . " volumes all done!</b>");
    }
}
if ($_REQUEST['submit'] != '' && $_REQUEST['act'] == '') {
    if (!file_exists(TARGET)) {
        printForm('Folder not exists!');
    }
    # Create File List
    $filelist = array();
    $filelist = GetFileList(TARGET);
    # Put all files from file list in ZIP archive
    foreach ($filelist as $val) {
        $content .= $val . "\r\n";
    }
    $fp = fopen("tmp/filelist.log", "w+");
    fwrite($fp, $content, strlen($content));
    fclose($fp);
    $totalvol = ceil(count($filelist) / LENGTH);
    rptout("应该有 " . $totalvol . " 个备份,现在开始备份...<hr>");
    //备份从这里起跳
    jump('?act=do&vol=0&total=' . $totalvol);
开发者ID:dalinhuang,项目名称:shopexts,代码行数:31,代码来源:big.php


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